var number, sortedNumber, i, j, temp: integer; digits: array[1..5] of integer;
begin clrscr;
write('Enter a five-digit number: '); readln(number);
for i := 1 to 5 do begin digits[i] := number mod 10; number := number div 10; end;
for i := 1 to 4 do begin for j := 1 to 4 do begin if digits[j] < digits[j+1] then begin temp := digits[j]; digits[j] := digits[j+1]; digits[j+1] := temp; end; end; end;
sortedNumber := 0; for i := 1 to 5 do begin sortedNumber := sortedNumber * 10 + digits[i]; end;
writeln('Digits in descending order: ', sortedNumber);
program SortDigits;
uses crt;
var
number, sortedNumber, i, j, temp: integer;
digits: array[1..5] of integer;
begin
clrscr;
write('Enter a five-digit number: ');
readln(number);
for i := 1 to 5 do
begin
digits[i] := number mod 10;
number := number div 10;
end;
for i := 1 to 4 do
begin
for j := 1 to 4 do
begin
if digits[j] < digits[j+1] then
begin
temp := digits[j];
digits[j] := digits[j+1];
digits[j+1] := temp;
end;
end;
end;
sortedNumber := 0;
for i := 1 to 5 do
begin
sortedNumber := sortedNumber * 10 + digits[i];
end;
writeln('Digits in descending order: ', sortedNumber);
end.