


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Exp no.- Date-6-3-
Aim: To implement using functions to check whether the given number is prime and display appropriate messages. (No built-in math function) Algorithm: Step 1: start Step 2: get the no. n from the user and int i, m=0, f=0. Step 3: m=n
Step 4: for(i=2, i<=m, i++) Step 5: start loop if(n%i==0) Step 6: print the non-prime no. Step 7: if(f==0) Step 8: print the prime no. Step 9: stop the loop Step 10: stop
Flowchart: start Get the no.. n from the user and int i, m=0, f=0. m=n
for(i=2, i<=m, i++) if(f==0) (^) if(n%i==0) print the prime no. print the non-prime no. stop
Output: Result: Hence we developed a program to Implement using functions to check whether the given number is prime and display appropriate messages. (No built-in math function).