program prime_checker;
var
number:Qword;
i:integer;
begin
write('Give number to check');
readln(number);
for i:=2 to (number-1) do
begin
if (number mod i)=0 then begin
writeln(number,' is not a prime number');
break;
end;
if i=(number-1) then
writeln(number,' is prime!');
end;
end.
Checks if a given number is prime or not.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.