c语言华氏度如何转换成摄氏度?
输入一个华氏温度F,要求输出摄氏温度C。
通过程序来计算式子:(a + b)*c/(d*d - e*e*e)。
摄氏度华氏度之间的关系:
摄氏温度(℃)和华氏温度(℉)之间的换算关系为: 华氏度=摄氏度×1.8+32 摄氏度=(华氏度-32)÷1.8 5(华氏度-50)=9(摄氏度-10)。
注意:若F为华氏温度,C为摄氏温度,则转换公式为C=5/9 (F−32),输出结果取2位小数。特别注意公式转换为C语言表达式时的正确性。
语言-计算摄氏温度
#include<stdio.h>
intmain()
{
intF,C
scanf("%d",&F)
C=5*(F-32)/9
printf("Celsius=%d",C)
return0
}
绛旓細鍏紡锛C=5.0/9.0*(F-32);include<stdio.h> voidmain(){ floatC,F;printf(鈥淚nputF:鈥);scanf("%f",&F);//杈撳叆鍗庢皬搴 C=5.0/9.0*(F-32);//鎹㈢畻鍏紡 printf(鈥淐=%f\n鈥,C);//杈撳嚭缁撴灉 }
绛旓細鎸夌収浣犵殑瑕佹眰缂栧啓鐨鍗庢皬娓╁害杞负鎽勬皬娓╁害鐨C璇█绋嬪簭濡備笅 include<stdio.h> float FtoC(float F){ return (F-32)*5/9.0;} int main(){ float F,C;printf("璇疯緭鍏ュ崕姘忓害:\n");scanf("%f",&F);//杈撳叆鍗庢皬搴 C=FtoC(F);//璋冪敤FtoC鍑芥暟瀹炵幇鍗庢皬搴﹁浆鎽勬皬搴 printf("鎽勬皬搴︿负%.2f",C...
绛旓細include <stdio.h>int main(){ double c, f; printf ("璇疯緭鍏鍗庢皬娓╁害锛"); scanf ("%lf", &f); c=5.0/9*(f-32); printf ("%g鍗庢皬娓╁害鏄%.2f鎽勬皬娓╁害\n", f, c); return 0;}
绛旓細include <stdio.h>int main(){int f,c;scanf("%d",&f);c=5*(f-32)/9;printf("Celsius = %d",c);return 0;}
绛旓細涓嬮潰鏄皢鍗庢皬娓╁害F=100杞崲涓烘憚姘忔俯搴鐨C璇█浠g爜绀轰緥锛屽叾涓寘鍚敞閲婁互甯姪鐞嗚В锛氳緭鍑虹粨鏋滀负锛歷bnet100.00 degrees Fahrenheit is equal to 37.78 degrees Celsius.瑙i噴锛氱1琛岋細鍖呭惈stdio.h澶存枃浠讹紝浠ヤ究浣跨敤printf鍑芥暟銆傜3琛岋細瀹氫箟浜嗕袱涓彉閲廸鍜宑锛岄兘鏄诞鐐圭被鍨嬶紝鐢ㄤ簬瀛樺偍鍗庢皬娓╁害鍜屾憚姘忔俯搴︺傜6琛...
绛旓細include<stdio.h> main(){ float x,y;int z;printf("璇烽夋嫨:\n");printf("(1)灏嗘俯搴︿粠鎽勬皬搴﹁浆鎹负 鍗庢皬搴 銆(2)灏嗘俯搴︿粠鍗庢皬搴﹁浆鎹负鎽勬皬搴");scanf("%d",&z);if(z==1){ printf("璇疯緭鍏ヨ杞崲鐨勬俯搴:")scanf("%f",&x);y=x*1.8+32;printf("杞崲鍚庣殑娓╁害涓 f 鍗庢皬搴",y...
绛旓細C璇█绋嬪簭锛歩nclude <stdio.h>int main(){double f, c;printf("璇疯緭鍏鎽勬皬娓╁害鍊硷細");scanf("%lf", &c);f = 9.0 / 5 * c + 32;printf("鍗庢皬娓╁害鍊硷細%lf\n", f);printf("璇疯緭鍏ュ崕姘忔俯搴﹀硷細");scanf("%lf", &f);c = (f - 32) * 5 / 9;printf("鎽勬皬娓╁害鍊硷細%lf\n...
绛旓細include<stdio.h>int main(){int d; float t,t1;printf("纭畾瑕杞崲鐨勭被鍨:\n1)鍗庢皬杞鎽勬皬\n");printf("2)鎽勬皬杞崕姘\n璇烽夋嫨1鎴2:");scanf("%d",&d);printf("璇疯緭鍏ユ俯搴:");scanf("%f",&t);if(d==1){t1=(t-32)*5/9; printf("鎽勬皬娓╁害涓%.2f搴n",t1);}else{t1=t*...
绛旓細鎽勬皬娓╁害涓鍗庢皬娓╁害鐨勬崲绠楀紡鏄: 5(t F- 50)=9(t C-10 ) 寮忎腑t F鈥斺斿崕姘忔俯搴,t C鈥斺旀憚姘忔俯搴
绛旓細浣犲ソ锛屾祴璇曢氳繃璇烽噰绾筹紒#include<stdio.h>void main(){ float C,F; //鏀逛负float for(F=0;F<=300;F+=20) { C=(5.0/9)*(F-32); //5.0 杞寲鎴double printf("%4.0f%10.1f\n",F,C); }}