/******************************************************************************
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 <stdio.h>
#include <stdbool.h>
#include <math.h>
int main()
{
printf("Crible \n");
bool tab[120] = {[ 0 ... 119 ] = 1};
tab[1] = false;
for (int i = 2 ; i < sqrt(120) ; i ++ ) {
if(tab[i] == true) {
for (int mul = i+i ; mul <= 120 ; mul+=i) {
tab[mul] = false;
}
}
}
printf("Les nombres premiers sont : ");
for(int i = 1 ; i < 120 ; i++) {
if(tab[i]) {
printf("%d ", i);
}
}
return 0;
}