#include <iostream>
#include <cmath>
using namespace std;
void Task22()
{
cout << "Вариант 22" << "\nВведите количество рублей (от 1 до 999): " << endl;
int amount;
cin >> amount;
if (amount > 999 || amount < 1)
{
cout << "Неверное количество рублей" << endl;
}
else if (amount % 10 == 1 && amount - 100 * (amount / 100) != 11)
{
cout << amount << " " << "рубль";
}
else if (amount % 10 > 1 && amount % 10 < 5 && (amount - 100 * (amount / 100)) / 10 != 1)
{
cout << amount << " " << "рубля";
}
else if (amount % 10 > 4 || (amount - 100 * (amount / 100)) / 10 == 1)
{
cout << amount << " " << "рублей";
}
else if (amount % 10 == 0 && amount / 10 != 0)
{
cout << amount << " "<< "рублей";
}
cout << endl << endl;
}
void Task15()
{
cout << "Вариант 15" << endl << "Введите два числа в пределах ста и нажмите <Enter>..." << endl;
int number1, number2, difference;
cin >> number1 >> number2;
if (number1 > 100 || number2 > 100)
cout << "Число выходит за пределы сотни";
else
{
cout << "Сколько будет" << " " << number1 << "-" << number2 << "? Введите ответ и нажмите <Enter>..." << endl;
cin >> difference;
if (difference == number1 - number2)
{
cout << "Правильно!";
}
else
{
cout << "Вы ошиблись!";
}
}
cout << endl << endl;
}
int main()
{
setlocale(LC_ALL, "Russian");
Task22();
Task15();
}