Test Whether a Number is Prime (किसी Number के Prime होने की जाँच करना) :-
Question:-
Write an algorithm and flowchart to test whether a given number is prime or not.
किसी दिए गए Number के Prime या Not Prime होने की जाँच करने के लिए Algorithm और Flowchart लिखिए।
Example:
Input:
N = 7
Output:
7 is a Prime Number
Solution:- Algorithm:-
Logic / Explanation
N % i == 0 → Check whether i is a factor of N.
COUNT = COUNT + 1 → Count the factors.
If COUNT == 2 → Number is Prime.
Otherwise → Number is Not Prime.