program to display a menu for calculating area of a circle or perimeter of a circle.

radius=float(input("Enter radius of the circle:"))
print("1.calculate area")
print("2.calculate perimeter")
Choice=int(input("Enter your choice (1or2):"))
if choice == 1:
   area=3.14159*radius*radius
   print("area of circle with radius", radius,'is',area)
    else:
         perm=2*3.14159*radius
         print ("perimeter of circle with radius", radius,'is',perm)


Output
Enter radius of circle : 2.5
        1.calculate area
         2.calculate perimeter
Enter your choice(1or 2):1
area of circle with radius 2.5 is 19.6349375

Comments

Popular posts from this blog

program that reads two numbers and an arithmetic operator and displays the computed result.

program to find the multiples of a number ( the divisor) out of given five numbers.