Guest User

Untitled

a guest
May 27th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. int main()
  2. int counter
  3. {
  4. int num , guess;
  5. counter = 0;
  6. srand(time(0));
  7. num = rand() % 200 + 1;
  8.  
  9. printf ( "Guessing game, guess the number between 1 and 200" );
  10.  
  11. do {
  12. scanf ( "%d" , &guess);
  13. if ( guess > num ){
  14. printf ( "Too high" );
  15. }
  16.  
  17. if ( guess < num ){
  18. printf ( "Too low" );
  19. }
  20.  
  21. if ( guess == num ){
  22. counter++;
  23. printf ( "Your guess is correct!, it took you %d tries" , counter );
  24. }
  25.  
  26.  
  27. }while (guess != num);
  28.  
  29. return 0;
  30.  
  31. }
Add Comment
Please, Sign In to add comment