+ 2
What the mistaks in this code to print the prime numbers .. And give me the true one ..thank you
#include <iostream.h> int main() { int n,s,p; cout<< "enter number"; cin>>p; for(n=1;n<=p;n++) { if (p%n!=0) { s=1 break ; cout <<"not prime"; } else { s=0 } } if(s==0) cout <<"prime"; return 0; }
18 Answers
0
sure I have the solution to this
+ 4
No need for the using namespace std?and the break might be a mistake I think...
+ 4
The code will never print because before printing anything you break out of the loop
+ 3
I guess the code cannot run...
+ 1
where can I send you a pic of the code
+ 1
if(p%n ==0) print not prime number
else (p%n !=0) print prime number
+ 1
just be simple your complicating things
+ 1
how we can modefid it? 💔
+ 1
🐸🐸
0
يا ريت تكتبلي التعديلات و مشكور
0
I don't understand Arabic too
0
اعمل كوبي بيست هون اذا بصير
0
😂😂😂😂😂 write here if you can
0
we need to fix all numbers below the the fixed number so if statement dont enough ..is not??
0
well I didn't understand your question? you want to check if a number is prime or not?
0
yes
0
We can
0
but break in if statment not for all program