1 solutions
-
0
C++ :
#include<iostream> #include<cmath> using namespace std; bool prime(int n) { int i,t=sqrt(n); for (i=2; i<=t; i++) if (n%i==0) break; return i>t; } int main() { int n; cin>>n; if (prime(n)) cout<<"prime"<<endl; else cout<<"not prime"<<endl; return 0; }
- 1
Information
- ID
- 19159
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- (None)
- # Submissions
- 0
- Accepted
- 0
- Uploaded By