# Find area of a circle in C, C++, Java and Python | faceprep

Program to find the area of a circle is discussed here. Area of the circle can be found using the formula, Area = πr², where r is the radius of the circle. When the radius of the circle is known, the area of the circle can be calculated using the formula mentioned.

INPUT & OUTPUT FORMAT:

• The input corresponds to the radius of the circle.
• The output corresponds to the area of the circle and it should be a floating point variable with 2 point precision.

## Program to find area of a circle using functions

// Area of a circle in C programming

#include <stdio.h>
#include <math.h>

{
}
int main()
{
printf(“\nEnter the radius of the circle : “);
printf(“\nArea of the circle : %f\n”, area);
return 0;

// C++ program to find the area of a circle

#include <iostream>
#include <math.h>
using namespace std;

{
}

int main()
{
cout << “\nEnter the radius of the circle : “;
cout << “\nArea of the circle : ” << area <<endl;
return 0;
}

// Java program to find the area of a circle
import java.util.*;
public class Main
{
{
}

public static void main (String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print(“\nEnter the radius of the circle : “);
System.out.println(“Area of the circle : ” + area_of_a_circle(radius));

}
}

# Python program to find the area of a circle

from math import pi
print (“The area of the circle is: ” + area_of_a_circle(radius))

## Program to find area of a circle using pointers

#include <stdio.h>
#include <math.h>

{
}

#include<stdio.h>

int main()
{

printf(“\nEnter the radius of Circle : “);
printf(“\nArea of Circle : %f”, area_of_circle(&radius));

return (0);
}

#include <iostream>
#include <math.h>
using namespace std;

{
}

int main()
{

cout << “\nEnter the radius of Circle : “;
cout << “\nArea of Circle : ” << area_of_circle(&radius);
return 0;
}

## Program to find area of circle using command line arguments

/*Here diameter is taken as the input*/

#include<stdio.h>
#define PI 3.14
int main(int a, char *b[])   //command line arguments
{
int d; float area =0;
d= atoi(argv);
area =(float) PI*(d/2)*(d/2);
printf(“%0.2f”, area);    //%0.2f is to print the answer with 2 values after decimal point.
return 0;
}

Output: 