간단한 사칙연산

두 개의 실수 값을 입력 받아 각 사칙연산(+, -, *, /)결과를 출력하는 프로그램을 만들어 보자! 다음 결과화면과 같이 출력이 되도록 프로그램을 작성하십시오.

입력 예

54.4 41.77

출력 예

96.17000 12.63000
2272.288000 1.302373

image

Source

#include<stdio.h>
int main(void) {
	double x=0, y=0;

	printf("입력: ");
	scanf("%lf %lf", &x, &y);

	printf("+: %lf\n", x + y);
	printf("-: %lf\n", x - y);
	printf("*: %lf\n", x * y);
	printf("/: %lf\n", x / y);

	return 0;
}

태그:

카테고리:

업데이트: