c语言编程中怎么将华氏温度转换成摄氏温度? C语言编程:输入一个华氏温度,要求输出摄氏温度,公式为:
c\u8bed\u8a00\u7f16\u7a0b\uff0c\u5c06\u534e\u6c0f\u6e29\u5ea6\u8f6c\u6362\u6210\u6444\u6c0f\u6e29\u5ea6\u3002\u8f6c\u6362\u516c\u5f0f\u4e3a\uff1ac=5/9 * (f-32)\uff0c\u5176\u4e2df\u4ee3\u8868\u534e\u6c0f\u6e29\u5ea6\u7528\u8fd9\u4e2a\u7a0b\u5e8f\u53ef\u4ee5\u5b9e\u73b0
#include
float change(float x);
void main(){
float fahr;
printf("\u8bf7\u8f93\u5165\u6444\u6c0f\u6e29\u5ea6:");
scanf("%f",&fahr);
printf("\n\u5bf9\u5e94\u7684\u534e\u6c0f\u6e29\u5ea6\u4e3a\uff1a%.1f\n\n",change(fahr));
}
float change(float x){
float cent=x*9/5+32;
return cent;
}
#include int main(){ double c, f; printf ("\u8bf7\u8f93\u5165\u534e\u6c0f\u6e29\u5ea6\uff1a"); scanf ("%lf", &f); c=5.0/9*(f-32); printf ("%g\u534e\u6c0f\u6e29\u5ea6\u662f%.2f\u6444\u6c0f\u6e29\u5ea6\n", f, c); return 0;}
\u6269\u5c55\u8d44\u6599\uff1a
#include
using namespace std;
int main()
{
float f,c;
cout<<"\u8bf7\u8f93\u5165\u534e\u6c0f\u6e29\u5ea6\uff1a";
cin>>f;
c=5*(f-32)/9;
cout<<"\u6444\u6c0f\u6e29\u5ea6\u4e3a:"<<c<<endl;
return 0;
}
#include
voidmain()
{
floatf,c;
printf("请输入您需要转换的摄氏温度:");
scanf("%f",&c);
f=(c+32)*9/5.0;
printf("其对应的华氏温度为:%.2f\n",f);
}
2.
main()
{
float c,f;
scanf("%f",&f);
c=5.0/9*(f-32);
printf("%8.2f",c);
}
3.
#include
int main(void)
{
float c;
printf("请输入摄氏度: ");
scanf("%f",&c);
printf("对应的华氏度:%.2f\n ",(c + 92) * 9 / 5);
return 0;
}
绛旓細涓嬮潰鏄灏嗗崕姘忔俯搴F=100杞崲涓烘憚姘娓╁害C鐨C璇█浠g爜绀轰緥锛屽叾涓寘鍚敞閲婁互甯姪鐞嗚В锛氳緭鍑虹粨鏋滀负锛歷bnet100.00 degrees Fahrenheit is equal to 37.78 degrees Celsius.瑙i噴锛氱1琛岋細鍖呭惈stdio.h澶存枃浠讹紝浠ヤ究浣跨敤printf鍑芥暟銆傜3琛岋細瀹氫箟浜嗕袱涓彉閲廸鍜宑锛岄兘鏄诞鐐圭被鍨嬶紝鐢ㄤ簬瀛樺偍鍗庢皬娓╁害鍜屾憚姘忔俯搴︺傜6琛...
绛旓細鍏紡锛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);//杈撳嚭缁撴灉 }
绛旓細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*...
绛旓細鍗庢皬搴 銆(2)灏嗘俯搴︿粠鍗庢皬搴﹁浆鎹涓烘憚姘忓害");scanf("%d",&z);if(z==1){ printf("璇疯緭鍏ヨ杞崲鐨勬俯搴:")scanf("%f",&x);y=x*1.8+32;printf("杞崲鍚庣殑娓╁害涓 f 鍗庢皬搴",y);} else { printf("璇疯緭鍏ヨ杞崲鐨勬俯搴:")scanf("%f",&x);y=(x-32)*5/9;printf("杞崲鍚庣殑娓╁害涓...
绛旓細鍙互鍙傝冧笅闈㈢殑浠g爜锛歩nclude <stdio.h> int main(void){ float c,f;printf("璇疯緭鍏ヤ竴涓鍗庢皬娓╁害:\n");scanf("%f",&f);c=(f-32)*5/9;printf("瀵瑰簲鐨勬憚姘忔俯搴︽槸:%.2f\n",c);}
绛旓細include<stdio.h> void main(){ float c,f;int n;for ( n=0,f=30;n<10;n++,f+=1.0 )while ( 1 ){ c=(f-32)/1.8;printf(" 鍗庢皬%lf搴 鎽勬皬%lf搴n",f,c);} }
绛旓細include<stdio.h> float change(float x);void main(){ float fahr;printf("璇疯緭鍏ユ憚姘忔俯搴:");scanf("%f",&fahr);printf("\n瀵瑰簲鐨鍗庢皬娓╁害涓猴細%.1f\n\n",change(fahr));} float change(float x){ float cent=x*9/5+32;return cent;} ...
绛旓細include "stdio.h"int main(int argv,char *argc[]){int f;printf("Please enter the Fahrenheit temperature f...\nf=");scanf("%d",&f);printf("c = %g掳C\n",5.0/9*(f-32));return 0;}杩愯鏍蜂緥锛
绛旓細绋嬪簭濡備笅锛歩nclude <stdio.h> int main(){ int f;float c;printf("璇疯緭鍏ヤ竴涓鍗庢皬娓╁害\n");scanf_s("%d", &f);c = (float)(f - 32) * 5 / 9;printf("瀹冪殑鎽勬皬娓╁害涓:%.2f", c);} 濡傚浘锛氳皟璇曢氳繃锛
绛旓細鎽勬皬娓╁害涓鍗庢皬娓╁害鐨鎹㈢畻寮忔槸: 5(t F- 50)=9(t C-10 ) 寮忎腑t F鈥斺斿崕姘忔俯搴,t C鈥斺旀憚姘忔俯搴