If_06 더 큰 수 알려주기

두 수를 입력 받아 더 큰 수 알려주기

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
#include <stdio.h>
#include <Windows.h>
 
int main(void) {
 
    double temp1 = 0;
    double temp2 = 0;
 
    printf("첫번째 수를 입력하시오.\n");
    scanf_s("%lf"&temp1);
    printf("두번째 수를를 입력하시오.\n");
    scanf_s("%lf"&temp2);
 
    if (temp1 == temp2) {
        printf("%.2lf와 %.2lf는 같습니다.\n", temp1, temp2);
    }
    else if (temp1 > temp2) {
        printf("%.2lf 가 %.2lf 보다 큽니다.\n", temp1, temp2);
    }
    else {
        printf("%.2lf 가 %.2lf 보다 큽니다.\n", temp2, temp1);
    }
 
    system("pause");
 
    return 0;
}
cs

댓글