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.
Tutorialspoint

Compile and Execute Pascal Online

Program Prime_No;
var num,count,remainder:real;
begin
    writeln('Input a number to check if it is a prime number.');
    readln(num);
    count:=2;
    remainder:=1;
    repeat until count<=num and remainder=1
        remainder:= num mod count;
        count:= count+1;
    if remainder=0
        writeln('the number ',num,' is not a prime number.');
    else
        writeln('the number ',num,' is a prime number.');
end.

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.