Current location - Training Enrollment Network - Early education courses - Early education teachers and others
Early education teachers and others
# include & ltstdio.h & gt

# include & ltstdlib.h & gt

# include & lttime.h & gt

int main(void)

{

int a,b,I;

Srand ((unsigned) time (empty));

a = rand()% 100+ 1;

printf("%d\n ",a);

for(I = 1; ; i++)

{

Printf ("Please enter a number between 1 and 100:");

scanf("%d ",& ampb);

If (a == b)

{

Printf ("The result is correct. \ n \ n ");

Break;

}

else if(a & gt; b)

{

Printf ("The number you entered is very small. \ n ");

}

other

{

Printf ("The number you entered is very large. \ n ");

}

printf(" \ n ");

}

Printf ("The number of times you entered is %d\n", i);

}