Q100. 센티미터(1 ~ 100, 2씩 증가)를 밀리미터, 미터, 인치로 환산하는 프로그램을 작성하시오.(while)
(300점)
print("-" * 60)
print("%7s \t %7s \t %7s \t %7s" % ("cm", "mm", "m", "inch"))
print("-" * 60)
cm = _______
while cm < ______ :
mm = cm * 10.0
m = cm * 0.01
inch = cm * 0.3937
print("%7d \t %7.0f \t %7.2f \t %7.1f" % (______, ______, ______, ______))
cm = ___________
print("-" * 60)
- 난이도(1~10) : 3
- 힌트 : 없음
- - 실행 결과
-
------------------------------------------------------------
cm mm m inch
------------------------------------------------------------
1 10 0.01 0.4
3 30 0.03 1.2
5 50 0.05 2.0
7 70 0.07 2.8
...
97 970 0.97 38.2
99 990 0.99 39.0
------------------------------------------------------------
print("-" * 60)
print("%7s \t %7s \t %7s \t %7s" % ("cm", "mm", "m", "inch"))
print("-" * 60)
cm = 1
while cm < 101 :
mm = cm * 10.0
m = cm * 0.01
inch = cm * 0.3937
print("%7d \t %7.0f \t %7.2f \t %7.1f" % (cm, mm, m, inch))
cm = cm + 2
print("-" * 60)