C程序
#include<stdio.h>
#include<stdlib.h>
/*
对F华氏温度0,20,40,60,……300
转换成对应的摄氏温度
转换公式C=(5/9)*(F-32)
输入:F
输出:C
累加值:step=20
温度下限:lower=0
温度上线:upper=300
*/
void main()
{
int F, C;
int step = 20;
int lower = 0;
int upper = 300;
C = 0;
F = lower;
while (F <= upper)
{
C = 5*(F - 32)/9; //9的位置如果放前面会使所有的C=0
printf("F=%d\tC=%d\n", F, C);//\t 和\n并用可以制表
F = F + step;
}
system("pause");
}