program DecimalToBinary;
varnumber, quotient, remainder, i: integer;binaryNumber: array[1..8] of integer;
beginwrite('Enter a decimal number (0 to 255): ');readln(number);
if (number < 0) or (number > 255) thenbeginwriteln('Number should be between 0 and 255.');exit;end;
quotient := number;
for i := 8 downto 1 dobeginremainder := quotient mod 2;binaryNumber[i] := remainder;quotient := quotient div 2;end;
write('Binary representation: ');for i := 1 to 8 dobeginwrite(binaryNumber[i]);end;
end.
program DecimalToBinary;
var
number, quotient, remainder, i: integer;
binaryNumber: array[1..8] of integer;
begin
write('Enter a decimal number (0 to 255): ');
readln(number);
if (number < 0) or (number > 255) then
begin
writeln('Number should be between 0 and 255.');
exit;
end;
quotient := number;
for i := 8 downto 1 do
begin
remainder := quotient mod 2;
binaryNumber[i] := remainder;
quotient := quotient div 2;
end;
write('Binary representation: ');
for i := 1 to 8 do
begin
write(binaryNumber[i]);
end;
end.