C语言温度

#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;
    
}

 

posted @ 2017-01-15 16:19  landv  阅读(359)  评论(0编辑  收藏  举报