+ 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
6 Réponses
+ 1
this is the simpler version of your code
https://code.sololearn.com/cQ27iq2fC7h2/?ref=app
+ 11
Show your try plz 👀
+ 5
Hey Emozee Boy
Post your code here so that people can identify error and can help you.
+ 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.
+ 1
Here's an optimised version based on Kuyondo's solution.
https://code.sololearn.com/c7b66MMCRfe0/?ref=app