본문 바로가기
프로그램

[파이썬] 문제 : 반지름으로 넓이와 둘레 계산

by 오디세이99 2024. 6. 28.
728x90
반응형

 

 

R = int(input('Enter a radius of the circle: '))

pi=3.141592                # 파이값 지정
radius = 2 * pi * R        # 둘레 공식 : 반지금 * 2 * 3.14
area = R**2 * pi           # 면적 공식 : 반지금 * 반지금 * 3.14

print('pi =',pi)
print("radius of the circle =",R)
print(f"area of the circle = {area:.3f}")
print(f"circumference  of the  circle = {radius:.3f}")

728x90
반응형

댓글