Advertisement
desislava_topuzakova

06. Number in Range

Jan 23rd, 2022
708
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int number;
  7.     cin >> number;
  8.  
  9.     //валидно: числото е в [-100; 100] и е различно от 0 -> "Yes"
  10.     // 1. [-100; 100] -> число >= -100 и число <= 100
  11.     // 2. число != 0
  12.     //противен случай -> "No"
  13.  
  14.     if (number >= -100 && number <= 100 && number != 0)
  15.     {
  16.         cout << "Yes";
  17.     }
  18.     else
  19.     {
  20.         cout << "No";
  21.     }
  22.     return 0;
  23. }
  24.  
  25.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement