#include <iostream>
using namespace std;
int main()
{
int age;
setlocale(LC_ALL, "Russian");
cout << "Сколько вам лет?" << endl;
cin >> age;
if (age % 10 == 1)
cout << "Вам " << age << " год.";
else if (age % 10 >= 2 && age % 10 <= 4)
cout << "Вам " << age << " года";
else cout << "Вам " << age << " лет.";
}
#include <iostream>
using namespace std;
int main()
{
int age;
setlocale(LC_ALL, "Russian");
cout << "Сколько вам лет?" << endl;
cin >> age;
if (age % 10 == 1)
cout << "Вам " << age << " год.";
else if (age % 10 >= 2 && age % 10 <= 4)
cout << "Вам " << age << " года";
else cout << "Вам " << age << " лет.";
}