Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. #include <time.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int main() {
  6.       srand(time(0));
  7.       int number = rand() % 100 + 1;
  8.  
  9.       int guess;
  10.  
  11.       do {
  12.             printf("Enter your estimate: ");
  13.             scanf("%d",&guess);
  14.            
  15.             if (guess < number)
  16.                   printf("Your estimate is less, than the secret number \r\n");
  17.             else if (guess > number)
  18.                   printf("Your estimate is more, than the secret number \r\n");
  19.             else
  20.                   printf("Your guess is right! \r\n");
  21.       } while (guess != number);
  22.       return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement