Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main(void) {
- srand(time(NULL));
- int r = 5;
- int correct = 5;
- int guess;
- int counter = 0;
- int i=0;
- printf("Guess my number! 1 - 10");
- for (i;i==5;i++){
- if(counter == 5){
- printf("Limit 5x");
- break;
- }
- scanf("%d", &guess);
- if(guess < correct ){
- counter++;
- printf("Your guess is too low. Guess again. ");
- }else if(guess < correct){
- counter++;
- printf("Your guess is too high. Guess again. ");
- }else if(guess == correct){
- counter++;
- printf("You guessed correctly in %d tries! Congratulations!\n", counter);
- correct = 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement