Skip to content

Instantly share code, notes, and snippets.

Created December 20, 2012 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4342265 to your computer and use it in GitHub Desktop.
Save anonymous/4342265 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int input=0;
int random_number = rand() / RAND_MAX;
random_number = random_number * 100;
int count=0;
while(1) {
printf("guess my number! You have 10 tries!");
scanf("%d", input);
if(input > random_number) printf("smaller!");
if(input < random_number) printf("bigger!");
if(input == random_number) {
printf("you win!");
break;
}
count++;
if(count>9) {
printf("you lose!");
break;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment