commit
This commit is contained in:
33
CPP/Source8.cpp
Normal file
33
CPP/Source8.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Programme de calcul des nombres premiers
|
||||
* Par Florian Goussot
|
||||
* BTS CIEL 2e ann<6E>e
|
||||
* Fait le 05/11/2024 <20> Nancy
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
do {
|
||||
system("cls");
|
||||
printf_s("\t\t\tProgramme de calcul des nombres premiers\n");
|
||||
printf_s("Donnez le nombre limite (>3) : ");
|
||||
int nombres_premiers[100];
|
||||
int limite = 3;
|
||||
scanf_s("%d", &limite);
|
||||
for (int i = 0; i <= limite; i++) {
|
||||
int nb_diviseurs = 0;
|
||||
for (int j = 2; j <= i; j++) {
|
||||
if (i % j == 1) {
|
||||
nb_diviseurs++;
|
||||
}
|
||||
}
|
||||
if (nb_diviseurs == 1) {
|
||||
|
||||
}
|
||||
}
|
||||
printf_s("\n\nAppuyez sur Echap pour quitter...");
|
||||
} while (_getch() != 27);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user