#include <stdio.h>

int main() 
{
    int opt; // 사칙 연산 선택
    double num1, num2; // 연산 할 값
    double result;

    printf("1.덧셈 2.뺄셈 3.곱셈 4.나눗셈 \n");
    printf("선택? ");
    scanf("%d", &opt);
    printf("두 개의 실수 입력: ");
    scanf("%lf %lf", &num1, &num2);

    if(opt==1)
        printf("%g+%g=%g", num1, num2, num1+num2);

    if(opt==2)
        printf("%g-%g=%g", num1, num2, num1-num2);

    if(opt==3)
        printf("%g*%g=%g", num1, num2, num1*num2);

    if(opt==4)
        printf("%g/%g=%g", num1, num2, num1/num2);
    
    return 0;
}

Embed on website

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