4 solutions
-
-2
#include<bits/stdc++.h> using namespace std; bool prime(int n) { bool st=true; for(int i=2;i<=sqrt(n);i++) { if(n%i==0) { st=false; } } if(st) { return 1; } return 0; } int main() { int n; cin>>n; if(n==0||n==1) { cout<<"no"; } else if(prime(n)) { cout<<"yes"; } else { cout<<"no"; } return 0; }
Information
- ID
- 32
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- (None)
- # Submissions
- 299
- Accepted
- 61
- Uploaded By