You are on page 1of 2

#include <stdio.

h>
int main()
{
int admin_num,user_num[3],no_of_chances,i;
admin_num=6;
no_of_chances=3;
printf("\nYou have %d chances to guess the number",no_of_chances);
printf("\nGuess the number between 1 to 10");
for(i=0;i<=no_of_chances;i++)
{
printf("\nenter your number:");
scanf("%d",&user_num[i]);
if(admin_num!=user_num[i])
{
printf("You lose");
}
else
{
printf("You win");
break;
}
}
return 0;
}
Sample Input-
You have 3 chances to guess the number
Guess the number between 1 to 10
enter your number:3
You lose
enter your number:4
You lose
enter your number:6
You win

You might also like