program raf105;
var
n,sum: integer;
begin
write('Введите число: ');
readln(n);
abs(n);
repeat
sum:= sum + n mod 10;
n:= n div 10
until n = 0;
writeln('Сумма цифр: ',sum);
end.
PascalABC
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program raf105;
var
n,sum: integer;
begin
write('Введите число: ');
readln(n);
abs(n);
repeat
sum:= sum + n mod 10;
n:= n div 10
until n = 0;
writeln('Сумма цифр: ',sum);
end.
PascalABC