fork(1) download
  1. #include<iostream>
  2. #include<math.h>
  3. using namespace std;
  4. int main()
  5. {
  6. int i,n,count=0,k,m=0;
  7. // cout << "Enter a number:" << endl;
  8. cin >> n;
  9. for(i=2;i<n/2;i++)
  10. {
  11. if(n%i==0);
  12. ++count;
  13.  
  14. }
  15. cout << count << endl;
  16. if(count>0)
  17. cout << "not Prime" << endl;
  18. else
  19. cout << "prime" << endl;
  20. /*if(count > 0)
  21. {
  22. for(k=1;k>=n;k++)
  23. {
  24. if(pow(2,k)-1==n)
  25. m++;
  26.  
  27. }
  28. }
  29. if(m==1)
  30. cout << "Mersenne number" << endl;
  31. else
  32. cout << "Not a mersenne number" << endl;*/
  33. return 0;
  34. }
Success #stdin #stdout 0s 4416KB
stdin
7
stdout
1
not Prime