SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <iostream> | |
| 2 | using namespace std; | |
| 3 | ||
| 4 | int main() | |
| 5 | {
| |
| 6 | int valeurCible; | |
| 7 | cin >> valeurCible; | |
| 8 | - | for (int nombre = 2 ; nombre <= valeurCible ; nombre ++) |
| 8 | + | for (int nombre=2; nombre<=valeurCible; nombre++) |
| 9 | {
| |
| 10 | - | bool estPasPremier = false; |
| 10 | + | bool premier = true; |
| 11 | - | for(int diviseur = 2; diviseur < nombre; diviseur ++) |
| 11 | + | for(int diviseur=2; diviseur<nombre; diviseur++) |
| 12 | - | if (nombre%diviseur == 0) |
| 12 | + | if (nombre%diviseur==0) |
| 13 | - | estPasPremier=true; |
| 13 | + | premier=false; |
| 14 | - | if (!estPasPremier) |
| 14 | + | if (premier) |
| 15 | cout << nombre << endl; | |
| 16 | } | |
| 17 | return 0; | |
| 18 | } |