반응형
화씨온도 = (섭씨온도 x 1.8) + 32
섭씨온도 = (화씨온도 - 32) x 0.556
화씨온도를 섭씨온도로, 섭씨온도를 화씨온도로 변환하는 프로그램
코드:
#include <iostream>
using namespace std;
int main(){
cout << "화씨온도(F)와 섭씨온도(C)를 입력 하세요: ";
float fah, cel;
cin >> fah >> cel;
float fahrenheit, celsius;
celsius = (fah - 32) * 5 / 9;
fahrenheit = (cel * 9 / 5) + 32;
cout << "화씨" << fah << "F는" << "섭씨" << celsius << "C 입니다" << '\n';
cout << "섭씨" << cel << "C는" << "화씨" << fahrenheit << "F 입니다" << '\n';
}
728x90
그리드형(광고전용)