Skip to content

Instantly share code, notes, and snippets.

@jacks0n9
Last active October 15, 2020 01:42
Show Gist options
  • Save jacks0n9/0e2175fa10e14dd3f0f9efa965586b32 to your computer and use it in GitHub Desktop.
Save jacks0n9/0e2175fa10e14dd3f0f9efa965586b32 to your computer and use it in GitHub Desktop.
#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