fin de TP06
This commit is contained in:
29
DEV1.1/TP06/borne.c
Normal file
29
DEV1.1/TP06/borne.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int val1,val2,petit=10000,grand=-10000;
|
||||
while(val1!=-1 || val2!=-1) {
|
||||
printf("Donnez un entier : \n");
|
||||
scanf("%d",&val1);
|
||||
if (val1==-1)
|
||||
break;
|
||||
printf("Donnez un deuxieme entier : \n");
|
||||
scanf("%d",&val2);
|
||||
if (val2==-1)
|
||||
break;
|
||||
if (val1<val2){
|
||||
if (val1<petit)
|
||||
petit=val1;
|
||||
if (val2>grand)
|
||||
grand=val2;
|
||||
}else{
|
||||
if (val2<petit)
|
||||
petit=val2;
|
||||
if (val1>grand)
|
||||
grand=val1;
|
||||
}
|
||||
}
|
||||
printf("Le nombre le plus petit est %d et le plus grand est %d \n",petit,grand);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user