#include <stdio.h>
#include <stdlib.h>
int main()
{
printf(" \t \t This program to play a guess game with the user \n " ); printf("\n");
int x = rand()%11 , num ,counter=1 ;
printf( "Guss a number from 1 to 10 \n");
scanf("%d",&num);
if ( num>10 || num <1 )
printf("Please Run The Program again and put a number from 1 to 10 \n ");
else
do {
if ( num==x ) {
printf(" Congratulations You win (: \n " );break; }
else if (num != x) {
printf("Wrong guss 2 tries remaining ): \n " );
counter++; }
printf("\n");
printf( " try again and Guss a number from 1 to 10 \n");
scanf("%d",&num);
if ( num==x ) {
printf(" Congratulations You win (: \n " ) ;break; }
else if (num != x) {
printf("Wrong guss 1 tries remaining ): \n " );
counter++; }
printf("\n");
printf( " try again Guss a number from 1 to 10 \n");
scanf("%d",&num);
if ( num==x ) {
printf(" Congratulations You win (: \n " );break;}
else if (num != x) {
printf(" Sorry no tries remain You lose ): \n " );
counter++; }
}
while ( counter<=3 );
return 0;
}