mirror of
https://codeberg.org/DansLeRuSH/c-plus-plus-exercises.git
synced 2024-11-22 03:28:09 +00:00
Display the maximum on several entered numbers
This commit is contained in:
parent
815f75897d
commit
71c946ea01
1 changed files with 26 additions and 0 deletions
26
EX10_max_sur_plusieurs_nombres_saisis.cpp
Normal file
26
EX10_max_sur_plusieurs_nombres_saisis.cpp
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Auteur : ALBARET Franck
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <conio.h>
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
int Nbr;
|
||||||
|
int i=0;
|
||||||
|
int Max=0;
|
||||||
|
clrscr();
|
||||||
|
puts ("entrez un chiffre, entrez un zéro pour arrêter. \n");
|
||||||
|
scanf("%i",&Nbr);
|
||||||
|
while (Nbr!=0)
|
||||||
|
{
|
||||||
|
puts ("entrez un chiffre, entrez un zéro pour arrêter. \n");
|
||||||
|
scanf("%i",&Nbr);
|
||||||
|
if (Nbr>Max)
|
||||||
|
{
|
||||||
|
Max=Nbr;
|
||||||
|
}
|
||||||
|
i=i+1;
|
||||||
|
}
|
||||||
|
printf("Le nombre maximum est %i. \n",Max);
|
||||||
|
getch();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue