A Program to Find the Area of a Circle

In this example, we are giving a program to find the area of a circle. The rule of finding an area is: A = πr2.


Program to find the area of a circle:

  1. PI = 3.14
  2. r = float(input("Enter the value of radius: "))
  3. area = PI * r * r
  4. print("Area of circle: %.2f"%area)

Output:

Enter the value of radius: 3
Area of circle: 28.26