Предмет: Информатика,
автор: carevana
Дано трехзначное число. Найти число единиц в нем, число десятков в нем, число сотен в нем, сумму его цифр, произведение его цифр
NameOff:
На паскале?
Ответы
Автор ответа:
3
var unitsCount,
tensCount,
hundredsCount,
number : integer;
begin
readln(number);
unitsCount := number mod 10;
tensCount := (number div 10) mod 10;
hundredsCount := number div 100;
writeln('Count of units: ', unitsCount);
writeln('Count of tens: ', tensCount);
writeln('Count of hundreds: ', hundredsCount);
writeln('Sum of digits: ', unitsCount + tensCount + hundredsCount);
writeln('Multiplication of digits: ', unitsCount * tensCount * hundredsCount);
end.
tensCount,
hundredsCount,
number : integer;
begin
readln(number);
unitsCount := number mod 10;
tensCount := (number div 10) mod 10;
hundredsCount := number div 100;
writeln('Count of units: ', unitsCount);
writeln('Count of tens: ', tensCount);
writeln('Count of hundreds: ', hundredsCount);
writeln('Sum of digits: ', unitsCount + tensCount + hundredsCount);
writeln('Multiplication of digits: ', unitsCount * tensCount * hundredsCount);
end.
Похожие вопросы
Предмет: Русский язык,
автор: про756
Предмет: Английский язык,
автор: sanzhar222ow0gs6
Предмет: Қазақ тiлi,
автор: Аноним
Предмет: Геометрия,
автор: gri79fyf
Предмет: Алгебра,
автор: Малинка2012