Tp1.c
599 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdio.h>
void affichage(float x, float y, float z){
printf("%f %f %f\n", x, y ,z);
}
void lecture( float *a, float *b, float *c){
scanf("%f%f%f",a,b,c);
}
void permuter (float* a, float* b){
float tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
void minMax2(float* a, float* b){
if( *b < *a){
permuter(a,b);
}
}
void tri (float* a, float*b, float*c){
minMax2(a,b);
minMax2(b,c);
minMax2(a,b);
}
int main(){
float a,b,c;
lecture(&a,&b,&c);
affichage(a,b,c);
tri(&a,&b,&c);
affichage(a,b,c);
return 0;
}