[Cプログラム設計言語]練習1-15は1-2節の温度変換プログラムを書き直し、関数を用いて温度変換計算を実現する.
451 ワード
#include
#include
#define LOWER 0
#define UPPER 300
#define STEP 20
float power(float f)
{
float c;
c = (5.0/9.0) * (f - 32.0);
return c;
}
float power(float a);//
int main()
{
float fahr;//
for (fahr = LOWER; fahr <= UPPER; fahr = fahr + STEP){
printf("%3.0f %6.1f
",fahr,power(fahr));
}
return 0;
}
検証により関連機能を実現