Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <locale.h>
- using std::cout;
- using std::cin;
- int main() {
- setlocale(LC_ALL, "Russian");
- int age;
- cout << "Введите возраст(1-69) = ";
- cin >> age;
- if(age >= 1 && age <= 69) {
- if (age / 10 == 1 || age % 10 == 5 || age % 10 == 6 || age % 10 == 7 || age % 10 == 8 || age % 10 == 9)
- cout << age << "лет";
- else if (age % 10 == 1)
- cout << age << "год";
- else
- cout << age << "года";
- }
- else
- cout << "Неверный возраст";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement