3679 - C++作业1-2:温度转换
输入华氏温度,用下列公式将其转换为摄氏温度并输出。
C=5/9*(F-32)
Input
实数
Output
转换后的摄氏温度,实数。
Examples
Input
80
Output
26.6667
Solution C
#include <stdio.h> void main() { float c,f; scanf("%f",&f); c=5.0/9*(f-32); printf("%.4f",c); }
Solution C++
#include<iostream> using namespace std; int main() { double f,c; cin>>f; c=5.0/9*(f-32); cout<<c<<endl; return 0; }