c语言程序设计答案

1.// 华氏温度与摄氏温度对照表

#include<stdio.h>

#include<stdlib.h>

int main()

{

float fahr = 0,cels = 0;

int low = 0,max = 300,step = 20;

printf ("\t=========本程序输出华氏和摄氏的温度对照!==========\n\t2006-12-30\n");

fahr = low;

printf ("\n\n华氏温度: 摄氏温度:\n-------- --------\n");

for (;fahr <= max;)

{

cels = 5.0 / 9.0 * (fahr - 12);

printf ("%.0f\t\t %6.2f\n",fahr,cels);

fahr += step;

}

system("pause");

return 0;

}

2.#include <stdio.h>

void main(void)

{

float c,F;

printf("请输入华氏温度:");

scanf("%f",F);

c=5/(9*(F-32));

printf("对应摄氏温度为%.2f",c); //取2位小数

}