dim years years = inputbox("Введите ваш возраст") if years = 1 then msgbox("Мне 1 год") end if if years = 2 then msgbox("Мне 2 годa") end if if years = 3 then msgbox("Мне 3 годa") end if if years = 4 then msgbox("Мне 4 годa") end if if (years >= 5) and (years <= 19) then msgbox("Мне "+cstr(years)+" лет") end if
if years >= 20 then dim s s = "Мне "+cstr(years) if (years mod 10 = 1) then s = s + " год" end if if (years mod 10 >= 2) and (years mod 10 <= 4) then s = s + " годa" end if if (years mod 10 >= 5) and (years mod 10 <= 9) then s = s + " лет" end if if (years mod 10 = 0) then s = s + " лет" end if msgbox(s) end if
Сишарпик
string ArmanAge, IvanAge, RuslanAge;
Console.WriteLine("Введите возраст Армана."); ArmanAge = Console.ReadLine();
Console.WriteLine("Введите возраст Ивана."); IvanAge = Console.ReadLine();
Console.WriteLine("Введите возраст Руслана."); RuslanAge = Console.ReadLine();
if (byte.TryParse(ArmanAge, out byte ByteArmanAge) && ByteArmanAge < 115 &&
byte.TryParse(IvanAge, out byte ByteIvanAge) && ByteIvanAge < 115 &&
byte.TryParse(RuslanAge, out byte ByteRuslanAge) && ByteRuslanAge < 115)
{
byte MaxAge;
byte EqualAge;
if (ByteArmanAge > ByteIvanAge && ByteArmanAge > ByteRuslanAge)
{
MaxAge = ByteArmanAge;
Console.WriteLine($"Самый старший Арман, его возраст {MaxAge}.");
}
else if (ByteIvanAge > ByteArmanAge && ByteIvanAge > ByteRuslanAge)
{
MaxAge = ByteIvanAge;
Console.WriteLine($"Самый старший Иван, его возраст {MaxAge}.");
}
else if (ByteRuslanAge > ByteArmanAge && ByteRuslanAge > ByteIvanAge)
{
MaxAge = ByteRuslanAge;
Console.WriteLine($"Самый старший Руслан, его возраст {MaxAge}.");
}
else
{
EqualAge = ByteRuslanAge; // к примеру его возраст.
Console.WriteLine($"У всех парней одинаковый возраст, им по {EqualAge} лет.");
}
}
else
{
Console.WriteLine("Введите корректные значения.");
Console.ReadLine();
return;
}
Console.ReadLine();