#include <stdlib.h>
#include <stdio.h>
#include <time.h>main()
{
int dice,ran_dice,point=100;
int choice='Y';
printf("You got %d point.\n", point); // output point
while(choice=='Y'&& point!=0) {
printf("Please guess the dice number:"); // prompt user to input their guess
scanf("%d",&dice);
srand(time(NULL));
ran_dice = rand()%6+1; // generate random dice number
if (dice<1 || dice>6){
printf("Wrong input ! Please enter digit 1 to 6\n");
printf("Please guess the dice number:"); // prompt user to input their guess
scanf("%d",&dice);
srand(time(NULL));
ran_dice = rand()%6+1;}
printf("The dice is %d\n",ran_dice); // output result
if (dice==ran_dice) // compare the user's guess and the result
{printf("You win!\n"); // winning output
point=point+20;
printf("You have %d points.\n",point);}
else
{printf("Wrong guess!\n"); //lossing output
point=point-20;
printf("You have %d points.\n",point);}
printf("Do you want to continue(Y or N)?");
scanf("%c\n",&choice);
}
if (point==0)
printf("Sorry you have lost all your point, the game is over.\n");
system("PAUSE");
}
Above is a program I wrote but it is unable to loop. Can anyone pls solve the problem?