APL/APL1.1/TP06/ordre.c
2021-09-24 10:19:20 +02:00

38 lines
619 B
C

#include<stdio.h>
#include<stdlib.h>
int main(int argc, char * argv[]) {
int int1, int2, int3, result;
printf("Veuillez donner trois entiers : ");
result = scanf("%d %d %d", &int1, &int2, &int3);
if (result != 3) {
printf("Format invalide.\n");
return EXIT_FAILURE;
}
if (int1 > int2) {
int temp_int = int1;
int1 = int2;
int2 = temp_int;
}
if (int1 > int3) {
int temp_int = int1;
int1 = int3;
int3 = temp_int;
}
if (int2 > int3) {
int temp_int = int2;
int2 = int3;
int3 = temp_int;
}
printf("Dans l'ordre croissant : %d, %d, %d.\n", int1, int2, int3);
return EXIT_SUCCESS;
}