+ 1
Can anybody tell me how to check prime number in c++ using if else statement
Which condition will I put I think if(a%==0)
4 odpowiedzi
+ 2
Check the code section.
+ 1
What conditions do you think we need to check for a number to be prime? Or first tell us what is a prime number.
0
Just loot at the code section
0
A prime number n is only divisible by 1 and itself
Logics you need to check if a number n is divisible by 2...n/2 and if its divisible by any numbers in the range 2...n/2 then n is not a prime number else it is a prime number.