Program to find the Area of a circle

Program to find the Area of a circle

12 May 2023

12 May 2023

Write a program to find Area of a circle


Description about the Program to find the Area of a circle

Get the value for radius from the user and calculate the area of the circle for the given radius.

Area of circle = 3.14*radius*radius

Input

3

Output

28.26


C Program to find the Area of a circle???????

#include <stdio.h>

int main()

{

    float area,radius;

    printf(“Enter the radius”);

    scanf("%f",&radius);

    area=3.14*radius*radius;

    printf("%0.2f",area);

    return 0;

}


C++ Program to find the Area of a circle???????

#include <iostream>

using namespace std;

int main()

{

    float area,radius;

    cout<<"Enter the radius: ";

    cin>>radius;

    area=3.14*radius*radius;

    cout<<area;

    return 0;

}


Java Program to find the Area of a circle???????

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter the radius: ");

float radius = sc.nextFloat();

double area = 3.14 * radius * radius;

System.out.println(area);

}

}


Python Program to find the Area of a circle???????

Method 1

radius=float(input("Enter the radius: "))

area=3.14*radius*radius

print(area)

Method 2

from math import pi

radius=float(input("Enter the radius: "))

area=pi*radius*radius

print(area)



Related Articles

Ask Us Anything !