-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLISTA 12.c
69 lines (55 loc) · 1 KB
/
LISTA 12.c
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <stdio.h>
/*
int idade() {
printf("\nQual a sua idade?");
int idade;
scanf("%i", &idade);
return idade;
}
void diasVividos(int *x, float *dias_vividos) {
*dias_vividos = *x * 365.25;
}
int main(void) {
printf("Dias vividos\n\n");
float dias_vividos;
int Idade = idade();
diasVividos(&Idade, &dias_vividos);
printf("\n\n%.1f", dias_vividos);
return 0;
}
*/
float leia() {
printf("\n\nDigite um valor real: ");
float n;
scanf("%f", &n);
return n;
}
void ordenar(float *x, float *y, float *z) {
if (*x > *y) {
float aux = *y;
*y = *x;
*x = aux;
}
if (*x > *z) {
float aux = *z;
*z = *x;
*x = aux;
}
if (*y > *z) {
float aux = *z;
*z = *y;
*y = aux;
}
}
void escrevaResultado (float x, float y, float z) {
printf("%f", y);
}
int main () {
printf("Digite 3 numeros para saber o segundo maior: ");
float a = leia();
float b = leia();
float c = leia();
ordenar(&a, &b, &c);
escrevaResultado(a, b, c);
return 0;
}