Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Gundhon

Problemset: จำนวนเฉพาะ (2560)

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-07 14:54:10

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(){
    int s;
    cin >> s;
    
    if(s < 2 || s > 100){
       return 0;
    }

    vector<int> prime;

    for(int i = 2; i < s; i++){
        bool p = true;
        for(int j = 2; j <= sqrt(i); j++){
            if(i % j == 0){
                p = false;
                break;
            }
        }
        if(p){
            prime.push_back(i);
        }
    }

    for(int x: prime) cout << x << endl;



    return 0;
}