Advertisement
semsem_elazazy

practical 14

Dec 29th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.    int n;
  6.    printf("Enter a number (between 1 and 10):");
  7.    scanf("%d",&n);
  8.    while(n)
  9.    {
  10.    if(n<5)
  11.    printf("Too low! Try again!");
  12.    else if (n>5)
  13.    printf("Too high! Try again!");
  14.    else if (n==5)
  15.    {
  16.    printf("Congratulations! You guessed it!");
  17.    break;
  18.    }
  19.    }
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement