Last active
October 15, 2020 01:42
-
-
Save jacks0n9/0e2175fa10e14dd3f0f9efa965586b32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
int correct = 17; | |
int guess; | |
int guesses = 3; | |
int left = 3; | |
while(left != 0){ | |
printf("Enter guess: "); | |
scanf("%i", &guess); | |
if (guess < correct){ | |
printf("Guess Higher!\n"); | |
left = left - 1; | |
}else if(guess > correct){ | |
printf("Guess Lower!\n"); | |
left = left -1; | |
}else{ | |
printf("Correct!\n"); | |
exit(0); | |
} | |
} | |
printf("You loose!\n"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment