fetus Diary

2007/10/13(土) - ちょ

C/C++ 指定。

CelsiusとFahrenheitの比較表を作成する。ただし、Fahrenheit = 32 + ( Celsius * 9 ) / 5

出力例:

Celsius = -20   Fahrenheit = -4
Celsius = -10   Fahrenheit = 14
Celsius = -0    Fahrenheit = 32 水の擬固点
Celsius = 10    Fahrenheit = 50
Celsius = 20    Fahrenheit = 68
Celsius = 30    Fahrenheit = 86
Celsius = 40    Fahrenheit = 104
Celsius = 50    Fahrenheit = 122
Celsius = 60    Fahrenheit = 140
Celsius = 70    Fahrenheit = 158
Celsius = 80    Fahrenheit = 176
Celsius = 90    Fahrenheit = 194
Celsius = 100   Fahrenheit = 212 水の沸点
Celsius = 110   Fahrenheit = 230
Celsius = 120   Fahrenheit = 248 

出てきた回答

#include <stdio.h>
int main(void){
if(1){
printf(
"Celsius = -20   Fahrenheit = -4 ¥n"
"Celsius = -10   Fahrenheit = 14 ¥n"
"Celsius = -0    Fahrenheit = 32 水の擬固点 ¥n"
"Celsius = 10    Fahrenheit = 50 ¥n"
"Celsius = 20    Fahrenheit = 68 ¥n"
"Celsius = 30    Fahrenheit = 86 ¥n"
"Celsius = 40    Fahrenheit = 104 ¥n"
"Celsius = 50    Fahrenheit = 122 ¥n"
"Celsius = 60    Fahrenheit = 140 ¥n"
"Celsius = 70    Fahrenheit = 158 ¥n"
"Celsius = 80    Fahrenheit = 176 ¥n"
"Celsius = 90    Fahrenheit = 194 ¥n"
"Celsius = 100   Fahrenheit = 212 水の沸点 ¥n"
"Celsius = 110   Fahrenheit = 230 ¥n"
"Celsius = 120   Fahrenheit = 248 ¥n"
);
}
return 1;
}

ちょ…

# 凝固点と沸点を出力すべきかどうかもわからんし、桁ぞろえをどうするかもわからんのよね

コメント

コメントはありません。

名前
メール
コメント

※HTML タグは使えません。HTTP URL には自動リンクが張られます。

Captcha
画像から読み取れる文字を入力: