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
Написал на VBS, тот же бейсик, который есть в школах
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
const
nmax = 100;
function chisla(n: integer): byte;
var
k: byte;
begin
k := 0;
repeat
n := n div 10;
inc(k)
until n = 0;
chisla := k
end;
var
a: array[1..nmax] of integer;
n, i, count: integer;
begin
Writeln('Введите N: ');
Read(n);
count := 0;
for i := 1 to n do
begin
Read(a[i]);
count += chisla(a[i]);
end;
Writeln('Количество цифр во всех числах: ', count);
end.
Тестовое решение
Введите N:
5
123
12
432
1
12345
Количество цифр во всех числах: 14