zl程序教程

您现在的位置是:首页 >  后端

当前栏目

C语言温度

C语言 温度
2023-09-27 14:26:53 时间
#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {


    int i;
    int fahr,celsius;
    int lower,upper,step;
    lower = 0;//温度表的下限 
    upper = 300;//温度表的上限 
    step = 20;//步长
    
    fahr = lower;
     while(fahr<=upper){
         celsius = 5 *(fahr-32)/9;
         printf("%d\t%d\n",fahr,celsius);
         fahr=fahr+step;
    }
     scanf("%s",&i);
    return 0;
    
}