#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
void main()
{
int i[100];
int j[100];
int k;
int m;
clrscr();
printf("Enter the number of questions needed:");
scanf("%d",&m);
if (m<=100);
{
i[100]=rand()%m;
printf("%d \n",i,rand());
j[100]=rand()%m;
printf("%d",j,rand());
i[100]=rand()%m;
printf("%d \n",i,rand());
j[100]=rand()%m;
printf("%d",j,rand());
}
getch();
}
I want to generate random numbers when I press the amount. i.e. If i enter 50, then it should generate 50 random numbers between 1-100. But when i do so, I get only two number for each integer. i comes 212 and j comes as 412, then the program terminates.
Can someone tell me, what i should do? Is there any problem in my rand statement? Or do i have to use any other statement or string?