-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNumberGuess.c
38 lines (36 loc) · 988 Bytes
/
NumberGuess.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<windows.h>
int main()
{
int number,userno,a,count=5;
while (count>0)
{
printf("Enter any number: ");
scanf("%d",&userno);
srand(time(NULL));
number = rand() % 101;
printf("\n\n\t\t\tComputer Loading\n\n");
for (a=0;a<10;a++)
{
Sleep(100);
printf(".....");
}
if (number == userno)
{
printf("\n\nWow...... You win!!\n");
printf("Co,mputer number is: %d\n\n",number);
break;
}
else
{
printf("\n\nSorry... Wrong Number Guessed");
printf("\n\nComputer number is: %d\n\n",number);
}
count--;
printf("\n%d time remaining\n\n",count);
}
printf("\n\n\n\t\t\tGAME OVER\\n\n\n");
getch();
}