Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char recommencer = 'o';
- do
- {
- int nb = 0, suite = 0;
- const int MIN = 1, MAX = 50;
- cout << endl << "Saisir un entier compris entre " << MIN << " et " << MAX << " : ";
- cin >> nb;
- while (nb < 1 || nb > 50)
- {
- cout << nb << " n'est pas un nombre valable. Recommencer : ";
- cin >> nb;
- }
- for (int i = 1 ; i <= nb ; i++)
- {
- suite = (suite - 1) + i;
- cout << suite << " ";
- }
- cout << endl << endl << "Voulez-vous recommencer ? (o pour oui, n pour non)" << endl;
- cin >> recommencer;
- }
- while(recommencer != 'n');
- return 0;
- }
Add Comment
Please, Sign In to add comment