answersLogoWhite

0


Best Answer

Begin

Read num

for(i=2; i<num; i++)

if(num%2==0) then

print "the number is not a prime no.";

else if

print "the number is prime";

end if

Stop

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

PROGRAM prime_check;

VAR n, i, s : integer;

flag : boolean;

BEGIN

writeln('Enter any number');

readln(n);

flag := false;

s := trunc(sqrt(n*1.0));

FOR i := 2 TO s DO

IF ((n MOD i)=0) THEN

flag:=false

ELSE

flag:=true;

IF flag=true THEN writeln('It is a Prime number')

ELSE

writeln('Not a prime number');

END.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you Write a suitable pseudo code to check whether a number is prime or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write the Pseudocode to find the factorial of a number?

Pseudo code+factorial


Write a pseudo code to find the sum of digits of a given number reducing them to a single digit?

5


How do you write the pseudo code for an application that accepts a number as input and displays the value that is one more than the number?

input number print number + 1


How can i write pseudo code for C plus plus if i haven't even wrote the program yet?

You are going about this backwards. First, define the program. Second, describe its algorithm. Third, if needed, write pseudo code. (Sometime, algorithm and pseudo code is the same process.) Fourth, or third, write real code.


How does pseudo code operate?

It doesn't. Pseudo code isn't a programming language, it is just there to give an idea of how you could write a program.


How do you write the pseudo codes that will accept 7 numbers and display their sum?

Start accept 7 number calculate sum print sum stop


How do you write a pseudo code for find the quadratic equation?

computer scince


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


Write an algorithm to check whether a number is a prime number or not?

You can write out this algorithm. This will then be programmed into the device to make determining prime numbers easier.


How do you write suitable in a 4th grade sentence?

it is very suitable that


Explain Pseudo code for circular linked list?

write pseudocode for link list


What is the pseudocode for converting Fahrenheit to Celsius?

how to write the pseudo code for : (5/9)(f-32)