-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathch9.c
More file actions
41 lines (33 loc) · 669 Bytes
/
ch9.c
File metadata and controls
41 lines (33 loc) · 669 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
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void swap(double *pa, double *pb)
{
double temp;
temp = *pa;
*pa = *pb;
*pb = temp;
}
void line_up(double *maxp, double *midp, double *minp)
{
if (*minp > *midp)
{
swap(minp, midp);
}
if (*midp > *maxp)
{
swap(midp, maxp);
if (*minp > *midp)
{
swap(minp, midp);
}
}
}
int main(void)
{
double max, mid, min;
printf("실수값 3개 입력 : ");
scanf("%lf%lf%lf", &max, &mid, &min);
line_up(&max, &mid, &min);
printf("정렬된 값 출력 : %.1lf, %.1lf, %.1lf\n", max, mid, min);
return 0;
}