+ 1
C programe to check prime number or not using if condition
4 Answers
+ 2
step 1: ask user to input a number.
step 2: (optional-but will be good) check if user input number is positive or not.
step3: Iterate through all the numbers starting from 2 to (N/2) using aĀ for loopĀ and for every number check if it divides N. If we find any number that divides, we return false. If we did not find any number between 2 and N/2 which divides N then it means that N is prime and we will return True.
+ 1
Why not use if-statements?
+ 1
Ok also use if statements,I'm new to programming
+ 1
I would suggest doing the C course on Sololearn and showing us your attempt first