Дано целое число в диапазоне 100-999.вывести строку -словесное описание данного числа.программа на языке паскаль

4 Июл 2021 в 19:45
106 +1
0
Ответы
1
program NumberDescription;
var
number, firstDigit, secondDigit, thirdDigit: integer;
description: string;
begin
writeln('Enter a number between 100 and 999: ');
readln(number);
firstDigit := number div 100;
secondDigit := (number div 10) mod 10;
thirdDigit := number mod 10;
case firstDigit of
1: description := 'One hundred ';
2: description := 'Two hundred ';
3: description := 'Three hundred ';
4: description := 'Four hundred ';
5: description := 'Five hundred ';
6: description := 'Six hundred ';
7: description := 'Seven hundred ';
8: description := 'Eight hundred ';
9: description := 'Nine hundred ';
end;
case secondDigit of
0: description := description + '';
2: description := description + 'twenty ';
3: description := description + 'thirty ';
4: description := description + 'forty ';
5: description := description + 'fifty ';
6: description := description + 'sixty ';
7: description := description + 'seventy ';
8: description := description + 'eighty ';
9: description := description + 'ninety ';
end;
case thirdDigit of
0: description := description + 'zero';
1: description := description + 'one';
2: description := description + 'two';
3: description := description + 'three';
4: description := description + 'four';
5: description := description + 'five';
6: description := description + 'six';
7: description := description + 'seven';
8: description := description + 'eight';
9: description := description + 'nine';
end;
writeln('Description of the number: ', description);
end.
17 Апр 2024 в 15:06
Не можешь разобраться в этой теме?
Обратись за помощью к экспертам
Гарантированные бесплатные доработки в течение 1 года
Быстрое выполнение от 2 часов
Проверка работы на плагиат
Поможем написать учебную работу
Прямой эфир