# include <stdio.h>
# include <math.h>

void main ()
{
	int i, siz, max;
	char fname[20];
	FILE *fin;

	printf("Enter the name of the file to be created : ");
	scanf("%s",fname);
	printf("Enter the number of elements in the file : ");
	scanf("%d",&siz);
	printf("Enter the maximum value for the random number generated : ");
	scanf("%d",&max);
	siz = abs(siz);
	fin = fopen (fname, "w");
	for(i=siz;i>0;i--) 
		if (max == 0)
		    fprintf(fin,"%d\n",rand(100));
		else
		    fprintf(fin,"%d\n",rand(100) % max);
	fclose (fin);
}
