+ 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)

16th Nov 2019, 4:27 PM
Moazzam Tariq
Moazzam Tariq - avatar
4 odpowiedzi
+ 2
Check the code section.
16th Nov 2019, 4:37 PM
Manual
Manual - avatar
+ 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.
16th Nov 2019, 4:30 PM
Avinesh
Avinesh - avatar
0
Just loot at the code section
16th Nov 2019, 9:51 PM
Аким Чигин
Аким Чигин - avatar
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.
18th Nov 2019, 11:48 AM
minirkk
minirkk - avatar