1. 程式人生 > >3-2 計算攝氏溫度

3-2 計算攝氏溫度

輸出格式 -h clu hit pan scan str 格式 out

3-2 計算攝氏溫度

給定一個華氏溫度F,本題要求編寫程序,計算對應的攝氏溫度C。計算公式:C=5×(F?32)/9。題目保證輸入與輸出均在整型範圍內。

輸入格式:

輸入在一行中給出一個華氏溫度。

輸出格式:

在一行中按照格式“Celsius = C”輸出對應的攝氏溫度C的整數值。

輸入樣例:

150

輸出樣例:

代碼:

Celsius = 65
#include<stdio.h>
int main()
{
int F,C;
scanf("%d",&F);
C=5*(F-32)/9;
printf("Celsius = %d",C);
return 0;
}

3-2 計算攝氏溫度