#include<stdlib.h>
#include<time.h>
#include<stdio.h>
void main()
{
int numbers[49];
int ball, run, i, j, k, flag;
run = 0;
ball = 0;
for(k=1; k<=49; k++)
numbers[k] = '\0';
printf("Here are your lottery numbers.\n");
do
{
srand((unsigned)time(NULL));
ball = rand()%49 + 1;
flag =0;
if(ball == numbers[ball])
{
flag = 1;
}
if(flag==0)
{
numbers[ball] = ball;
run = run + 1;
printf("%i\n",ball);
}
} while(run <= 6);
}
No comments:
Post a Comment