Langage c ++
2011991
-
arthurik Messages postés 166 Date d'inscription Statut Membre Dernière intervention -
arthurik Messages postés 166 Date d'inscription Statut Membre Dernière intervention -
Ecrire un programme qui saisi 20 entier >0 et affiche le minimum et le maximum de cet entier
Configuration: Windows Vista Firefox 3.0.15
2 réponses
-
-
Salut c'est une petite méthode.
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int min = 0, max = 0, nombre = 0,i = 0;
while(i < 20)
{
cout << "Tappez un nombre : ";
cin >> nombre;
while(nombre <= 0)
{
cout << "Ignore, Tappez un nombre plus grand que 0 : ";
cin >> nombre;
}
if(nombre > max)
max = nombre;
if(nombre < min)
min = nombre;
}
system("PAUSE");
return EXIT_SUCCESS;
}