Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <locale.h>
  4.  
  5.  
  6.  
  7. using std::cout;
  8.  
  9. using std::cin;
  10.  
  11.  
  12.  
  13. int main() {
  14.  
  15. setlocale(LC_ALL, "Russian");
  16.  
  17. int age;
  18.  
  19. cout << "Введите возраст(1-69) = ";
  20.  
  21. cin >> age;
  22.  
  23. if(age >= 1 && age <= 69) {
  24.  
  25. if (age / 10 == 1 || age % 10 == 5 || age % 10 == 6 || age % 10 == 7 || age % 10 == 8 || age % 10 == 9)
  26.  
  27. cout << age << "лет";
  28.  
  29. else if (age % 10 == 1)
  30.  
  31. cout << age << "год";
  32.  
  33. else
  34.  
  35. cout << age << "года";
  36.  
  37. }
  38.  
  39. else
  40.  
  41. cout << "Неверный возраст";
  42.  
  43. return 0;
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement