I want to build a guessing game with three choice limits. I tried an method which is an alternate from this video https://www.youtube.com/watch?v=KJgsSFOSQv0 (2:37:50) . But I am getting error. My code
#include<stdio.h>
int main(){
int Secretnumber=5;
int Guess;
int Totalguess=1;
printf("Enter a Number:");
scanf("%d",&Guess);
while(Guess!=Secretnumber && Totalguess<=3)
{
printf("Enter a Number:");
scanf("%d",&Guess);
Totalguess++;
}
if(Totalguess<=3){
printf("You Win");
}else{
printf("You Lose")
}
return 0;
}
Error:
$ make t
cc t.c -o t
t.c: In function ‘main’:
t.c:17:27: error: expected ‘;’ before ‘}’ token
17 | printf("You Lose")
| ^
| ;
18 | }
| ~
make: *** [<builtin>: t] Error 1
Aucun commentaire:
Enregistrer un commentaire