1 solutions
-
0
C++ :
#include<iostream> #include<math.h> #include<cstring> using namespace std; int n=100; int t; bool a[101]; int main() { memset(a,1,sizeof(a)) , a[1]=0; for (int i=2; i<=sqrt(n); ++i) if (a[i]) for (int j=2; j<=n/i; ++j) a[i*j]=0; t=0; for (int i=2; i<n+1; ++i) if (a[i]) { t++; if (t%5==0) cout<<i<<endl; else cout<<i<<" "; } return 0; }Pascal :
begin writeln('2 3 5 7 11'); writeln('13 17 19 23 29'); writeln('31 37 41 43 47'); writeln('53 59 61 67 71'); writeln('73 79 83 89 97'); end.
- 1
Information
- ID
- 16501
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By