#include <stdio.h>
int main()
{
int i,fahr,lower,upper;
double celsius;
printf("Enter lower and upper\n");
scanf("%d %d",&lower,&upper);
if(lower<=upper){
printf("fahr celsius\n") ;
for(fahr=lower;fahr<=upper;fahr=fahr+2)//for语句后面不加;分为三个表达式,表达式1只运行一次,中间用;隔开
{
celsius=(5.0/9.0)*(fahr-32);
printf("%4d %6.1f\n",fahr,celsius);//%md和%m.nf-----m指输出宽度,.n是指取小数点后n位
} }
else{
printf("Invalid Value!");
}
return 0;
}
今天是第4天啦,一早上就搁那琢磨c语言,真的上头哈哈哈哈哈,继续加油!!!