古詩詞大全網 - 成語經典 - cels

cels

// 華氏溫度與攝氏溫度對照表

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

}