Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
program project1;
var
num, i:integer;
begin
writeln('Enter a number:');
readln(num);
for i:=0 to num do
if (i = 2) or (i = 3) or (i = 5) then
writeln(i,' is a prime number')
else if (i mod 2 = 0) or (i mod 3 = 0) or (i mod 5 = 0) or (i mod 7 = 0) or (i = 1)then
writeln(i)
else
begin
writeln(i,' is a prime number')
end;
readln;
end.
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more