菜鸟C语言求助(华氏温度转化成摄氏温度) c语言编程,摄氏华氏温度转换
c\u8bed\u8a00\u7f16\u7a0b\u4e2d\u600e\u4e48\u5c06\u534e\u6c0f\u6e29\u5ea6\u8f6c\u6362\u6210\u6444\u6c0f\u6e29\u5ea6\uff1f1.
#include
voidmain()
{
floatf,c;
printf("\u8bf7\u8f93\u5165\u60a8\u9700\u8981\u8f6c\u6362\u7684\u6444\u6c0f\u6e29\u5ea6\uff1a");
scanf("%f",&c);
f=(c+32)*9/5.0;
printf("\u5176\u5bf9\u5e94\u7684\u534e\u6c0f\u6e29\u5ea6\u4e3a\uff1a%.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("\u8bf7\u8f93\u5165\u6444\u6c0f\u5ea6\uff1a ");
scanf("%f",&c);
printf("\u5bf9\u5e94\u7684\u534e\u6c0f\u5ea6\uff1a%.2f\n ",(c + 92) * 9 / 5);
return 0;
}
#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 "stdio.h"
void main()
{float fahr,celsius;<br _extended="true">int lower,upper,step;<br _extended="true">lower=0;<br _extended="true">upper=300;<br _extended="true">step=20;<br _extended="true">fahr=lower;<br _extended="true">printf("华氏 摄氏");<br _extended="true">while(fahr<=upper){<br _extended="true">celsius=(5.0/9.0)*(fahr-32.0);<br _extended="true">printf("%3.0f %6.1f\n",fahr,celsius);<br _extended="true">fahr=fahr+step;<br _extended="true">}
}
upper应初始化为 0
绛旓細鍥炵瓟锛氬湪while璇彞涓婇潰鍔犱竴涓緭鍑鸿鍙ヤ緥:printf("fahr celsius\n")浠ュ悗鍏卞悓瀛︿範鍟婃湁浠涔堜笉鎳傜殑鍙互缁х画闂晩350608412
绛旓細printf("\n 2.灏嗘憚姘忔俯搴﹁浆鎹㈡垚鍗庢皬娓╁害.\n");scanf("%d",&pd);if (pd==1) /*姝ゅ浼间箮搴旇鐢紳锛濊屼笉鏄紳*/ { printf("\n璇疯緭鍏ュ崕姘忔俯搴...\n");scanf("%f",&f);c=5.0/9*(f-32);printf("\n璇鍗庢皬娓╁害杞崲鎴鎽勬皬娓╁害涓:\n");printf("%-.2f",c);goto sh;}/***鍘...