Problem Description

珊珊在美國讀書,有一天覺得昏沉沉的全身不舒服,心想自己是不是發燒了。到藥局買了一支體溫計量了一下體溫,發現她的體溫是華氏 104 度。習慣了台灣的攝氏,她一時還不知道自己的體溫到底有多燒。你能不能幫她寫個程式,把華氏的溫度轉成攝氏的溫度。    

The Input

輸入僅有一行,含有一個整數 f (-460 ≤ f ≤ 2147483647),代表華氏溫度。

The Output

輸出計算所得的攝氐溫度,精確到小數點以下三位。

Sample Input

104

Sample Output

40.000

-----* Problem from【ZeroJudge, an Online Judge System For Beginners

My Answer

 
1
2
3
4
5
6
7
8
9
10
11
12
  #include<iostream>
#include<iomanip>

using namespace std;
int main(void)
{
  double f;
  while(cin>>f){
    //小數點定位取3位
    cout<<fixed<<setprecision(3)<<(f-32)*5/9<<endl; 
  }
  return 0;
}
 

 


arrow
arrow
    全站熱搜

    兔老大 發表在 痞客邦 留言(0) 人氣()