HI, I made a code which actually show correctly prime numbers but when I'm going to compile it, a judge shows me that my code is wrong. Can you tell me, guys, why judge don't want to accept my code ?
1. // http://www.spoj.com/problems/PRIME1/
2.
3. #include <iostream>
4. #include <cmath>
5. using namespace std;
6. int m,n;
7. int main()
8. {
9. cin >>m>>n;
10. for(m; m<=n;m++)
11. {
12. int p;
13. int c=1;
14. for(p=2;p<m-1;p++)
15. {
16. if(m%p!=0)
17. {
18. continue;
19. }
20. else
21. {
22. c=0;
23. }
24. }
25. if(c==0)
26. {
27. cout<<"";
28. }
29. else if(m==1) // that is because my code shows number 1 as a prime ,rest is good :slight_smile:
30. {
31. cout <<"";
32. }
33. else
34. {
35. cout << m << endl;
36. }
37. }
38. return 0;
39. }