English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

that reads an integer and outputs an statement telling whether or not the number is evenly divisible by 3? The program should also output the remainder and when being divided by 3 use if-then-else statement. Thanks!

2007-07-07 01:07:12 · 1 answers · asked by Ranil 1 in Computers & Internet Programming & Design

1 answers

program answer;
uses crt;
var
n:integer;
r: integer
begin
clrscr;
repeat
write('Enter an integer number:');
readln(n);
if (n mod 3 == 0 ) writeln(n, ' is divisible by 3') else
begin
writeln(n, ' is not divisible by 3');
r:=n-n div 3;
writeln('The remainder is ', r:4)
end;
readln;
until 1==2;
end.

2007-07-07 01:34:14 · answer #1 · answered by iyiogrenci 6 · 0 0

fedest.com, questions and answers