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