/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <cmath>
using namespace std;
int main() {
cout << "Crible" << endl;
// Initialisation à true
bool tab[120];
for (int i = 0; i < 120; i++) {
tab[i] = true;
}
tab[1] = false; // 1 n'est pas premier
for (int i = 2; i < sqrt(120); i++) {
if (tab[i]) {
for (int mul = i + i; mul < 120; mul += i) {
tab[mul] = false;
}
}
}
cout << "Les nombres premiers sont : ";
for (int i = 1; i < 120; i++) {
if (tab[i]) {
cout << i << " ";
}
}
cout << endl;
return 0;
}