#include <stdio.h>

/*
 출력자료형 함수이름(입력받을변수선언){
     함수에 들어가는 코드
 }
 */

// 섭씨 -> 화씨 온도 변환
float CelToFah(float Cel){
    return 1.8*Cel+32;
}

// 화씨 -> 섭씨 온도 변환
float FahToCel(float Fah){
    return (Fah-32)/1.8;
}


int main() {
    int num;
    float Fah, Cel;
    printf("1.섭씨->화씨 변환\n");
    printf("2.화씨->섭씨 변환\n");
    printf("숫자를 입력하세요.");
    scanf("%d", &num);

    switch(num) {
        case 1: // 
            scanf("%f", &Cel);
            printf("%f", CelToFah(Cel));
            break;
        case 2:
             scanf("%f", &Fah);
             printf("%f", FahToCel(Fah));
            
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: