| 1 | # include <stdio.h>
 | 
| 2 | 
 | 
| 3 | int main(){
 | 
| 4 |     int guess, attempt, number;
 | 
| 5 |     char message[] = "Game over";
 | 
| 6 |     number = 5;
 | 
| 7 |     attempt = 3;
 | 
| 8 |     for (int i = 0; i <= attempt; attempt--){
 | 
| 9 | 	    printf("Guess a Number:");
 | 
| 10 | 	    scanf("%d", &guess);
 | 
| 11 | 	   if (guess == number){
 | 
| 12 | 		   printf("You guessed it correctly!! %d:%d\n", guess,number);
 | 
| 13 | 		   break;
 | 
| 14 | 	   }else{
 | 
| 15 | 		printf("Try again!, you have %d chance left\n", attempt);
 | 
| 16 | 	   }
 | 
| 17 |     }
 | 
| 18 |     printf("The number you entered is %d\n", guess);
 | 
| 19 | }
 | 
| 20 | 
 | 
| 21 | 
 |