/*
Program rand2.c
This program demonstrates the use of the rand() function
*/
#include
main()
{
int target;
int guess;
int again;
printf("\nDo you want to guess a number 1 =Yes, 0=No ");
scanf("%d",&again);
while (again)
{
target = rand() % 100;
printf('\n What is your guess ? ");
scanf("%d",&guess);
while(target!=guess)
{
if (target>guess) printf("Too low");
else printf("Too high");
printf('\n What is your guess ? ");
scanf("%d",&guess);
}
printf("\n Well done you got it! \n");
printf("\n Do you want to guess a number 1=Yes, 0=No");
scanf("%d".&again);
}
}