+ 2

how to write a Simple program in C++ to verify whether a number is prime or not?

Help... !... I try but fail... M jst a beginner

21st Oct 2018, 5:25 PM
Emozee Boy
Emozee Boy - avatar
6 Respostas
+ 1
this is the simpler version of your code https://code.sololearn.com/cQ27iq2fC7h2/?ref=app
21st Oct 2018, 10:43 PM
Kuyondo
Kuyondo - avatar
+ 11
Show your try plz 👀
21st Oct 2018, 5:32 PM
Frost
Frost - avatar
+ 5
Hey Emozee Boy Post your code here so that people can identify error and can help you.
21st Oct 2018, 5:48 PM
Random
Random - avatar
21st Oct 2018, 6:25 PM
Emozee Boy
Emozee Boy - avatar
+ 1
overwrite line 16-21 with this, you also forgot to put a semicolon somewhere in line 11. if (num % i == 0) { count = 1; break; } } { if (count == 1) also put return 0; inside if(num==0) block.
21st Oct 2018, 10:10 PM
Kuyondo
Kuyondo - avatar
+ 1
Here's an optimised version based on Kuyondo's solution. https://code.sololearn.com/c7b66MMCRfe0/?ref=app
22nd Oct 2018, 4:54 AM
Alexandru Turculet
Alexandru Turculet - avatar