Advertisement
desislava_topuzakova

05. Number 100...200

Jan 14th, 2023
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. //1. входни данни -> цяло число
  7. //2. проверка за числото
  8. //под 100 -> "Less than 100"
  9. //до 200 вкл -> "Between 100 and 200"
  10. // над 200 -> "Greater than 200"
  11.  
  12. int number;
  13. cin >> number;
  14.  
  15. //серия от проверки (if - else if)
  16. //3 еднотипни проверки за големината на числото
  17. //само 1 от тези проверки да е вярна
  18.  
  19. if (number < 100)
  20. {
  21. cout << "Less than 100";
  22. }
  23. //противен случай: number >= 100
  24. else if (number <= 200)
  25. {
  26. cout << "Between 100 and 200";
  27. }
  28. //противен случай: number > 200
  29. else //if (number > 200)
  30. {
  31. cout << "Greater than 200";
  32. }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement