-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguess.c
More file actions
39 lines (39 loc) · 767 Bytes
/
guess.c
File metadata and controls
39 lines (39 loc) · 767 Bytes
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
39
/*
* =====================================================================================
*
* Filename: guess.c
*
* Description:
*
* Version: 1.0
* Created: 16-Oct-21 12:45:50
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include <stdlib.h>
#include <stdio.h>
int main(){
int number = 4;
int guess;
int guesscount = 0;
int guesslimit = 3;
while (guess != number){
if (guesscount < guesslimit){
printf("Enter a number: ");
scanf("%d", &guess);
guesscount++;
}
else {
printf("You are out of guess");
break;
}
}
if (guess == number){
printf("You Win");
}
}