Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: bestisyis...programming
Problemset: จำนวนเฉพาะ (2560)
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-06 13:47:32
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;
bool check;
cin >> n;
for(int i=2;i<n;i++){
check = true;
if(i==2) cout << '2' << endl;
else{
for(int j=2;j<=sqrt(i);j++){
if(i%j==0){
check = false;
break;
}
}
if(check){
cout << i << endl;
}
}
}
return 0;
}