# Calculate area of circle

Here given code implementation process.

``````// C Program
// Calculate area of circle
#include <stdio.h>

#include <math.h>

//Calculate area of circle by given radius
void circle_area(double r)
{
//M_PI containing π value 3.14159265358979323846
double area = M_PI * (r * r);
//Display the result of circle area
printf("Circle Radius : %lf , Circle Area : %lf\n", r, area);
}
int main()
{
//Test Cases
circle_area(63);
circle_area(15.5);
circle_area(34.47);
return 0;
}``````

#### Output

``````Circle Radius : 63.000000 , Circle Area : 12468.981242
Circle Radius : 15.500000 , Circle Area : 754.767635
Circle Radius : 34.470000 , Circle Area : 3732.780387``````
``````/*
Java program
Calculate area of circle
*/
public class CircleArea
{
//Calculate area of circle by given radius
public void circle_area(double r)
{
//Math PI containing π value nearly 3.141592653589793
double area = Math.PI * (r * r);
//Display the result of circle area
System.out.print("Circle Radius : " + r + " , Circle Area : " + area + "\n");
}
public static void main(String[] args)
{
CircleArea obj = new CircleArea();
//Test Cases
obj.circle_area(63);
obj.circle_area(15.5);
obj.circle_area(34.47);
}
}``````

#### Output

``````Circle Radius : 63.0 , Circle Area : 12468.981242097889
Circle Radius : 15.5 , Circle Area : 754.7676350249478
Circle Radius : 34.47 , Circle Area : 3732.7803865757082
``````
``````/*
C++ program
Calculate area of circle
*/
#include<iostream>
#include <math.h>
using namespace std;
class CircleArea
{
public:
//Calculate area of circle by given radius
void circle_area(double r)
{
//M_PI containing π value nearly 3.141592653589793
double area = M_PI *(r *r);
cout << "Circle Radius : " << r << " , Circle Area : " << area << "\n";
}
};
int main()
{
CircleArea obj =  CircleArea();
//Test Cases
obj.circle_area(63);
obj.circle_area(15.5);
obj.circle_area(34.47);
return 0;
}``````

#### Output

``````Circle Radius : 63 , Circle Area : 12469
Circle Radius : 15.5 , Circle Area : 754.768
Circle Radius : 34.47 , Circle Area : 3732.78``````
``````/*
C# program
Calculate area of circle
*/
using System;
public class CircleArea
{
//Calculate area of circle by given radius
public void circle_area(double r)
{
//Math PI containing π value nearly 3.141592653589793
double area = Math.PI * (r * r);
Console.Write("Circle Radius : " + r + " , Circle Area : " + area + "\n");
}
public static void Main(String[] args)
{
CircleArea obj = new CircleArea();
//Test Cases
obj.circle_area(63);
obj.circle_area(15.5);
obj.circle_area(34.47);
}
}``````

#### Output

``````Circle Radius : 63 , Circle Area : 12468.9812420979
Circle Radius : 15.5 , Circle Area : 754.767635024948
Circle Radius : 34.47 , Circle Area : 3732.78038657571``````
``````<?php
/*
Php program
Calculate area of circle
*/
class CircleArea
{
//Calculate area of circle by given radius
public 	function circle_area(\$r)
{
//M_PI  containing π value nearly 3.141592653589793
\$area = M_PI * (\$r*\$r);
//Display the result of circle area
echo("Circle Radius : ". \$r ." , Circle Area : ". \$area ."\n");
}
}

function main()
{
\$obj = new CircleArea();
//Test Cases
\$obj->circle_area(63);
\$obj->circle_area(15.5);
\$obj->circle_area(34.47);
}
main();``````

#### Output

``````Circle Radius : 63 , Circle Area : 12468.981242098
Circle Radius : 15.5 , Circle Area : 754.76763502495
Circle Radius : 34.47 , Circle Area : 3732.7803865757``````
``````/*
Node Js program
Calculate area of circle
*/
class CircleArea
{
//Calculate area of circle by given radius
circle_area(r)
{
//Math PI containing π value nearly 3.141592653589793
var area = Math.PI *(r *r);
//Display the result of circle area
process.stdout.write("Circle Radius : " + r + " , Circle Area : " + area + "\n");
}
}

function main(args)
{
var obj = new CircleArea();
//Test Cases
obj.circle_area(63);
obj.circle_area(15.5);
obj.circle_area(34.47);
}
main();``````

#### Output

``````Circle Radius : 63 , Circle Area : 12468.981242097889
Circle Radius : 15.5 , Circle Area : 754.7676350249478
Circle Radius : 34.47 , Circle Area : 3732.7803865757082``````
``````#   Python 3 program
#   Calculate area of circle
import math
class CircleArea :
# Calculate area of circle by given radius
def circle_area(self, r) :
# r indicates radius of circle
# math.pi containing π value nearly 3.141592653589793
area = math.pi * (r * r)

# Display the result of circle area
print("Circle Radius : ", r ," , Circle Area : ", area ,"\n", end = "")

def main() :
obj = CircleArea()
# Test Cases
obj.circle_area(63)
obj.circle_area(15.5)
obj.circle_area(34.47)

if __name__ == "__main__": main()``````

#### Output

``````Circle Radius :  63  , Circle Area :  12468.981242097889
Circle Radius :  15.5  , Circle Area :  754.7676350249478
Circle Radius :  34.47  , Circle Area :  3732.7803865757082``````
``````#   Ruby program
#   Calculate area of circle

class CircleArea

# Calculate area of circle by given radius
def circle_area(r)

# r indicates radius of circle
# Math PI containing π value nearly 3.141592653589793
area = Math::PI * (r * r)
# Display the result of circle area
print("Circle Radius  : ", r ," , Circle Area  : ", area ,"\n")
end
end
def main()

obj = CircleArea.new()
# Test Cases
obj.circle_area(63)
obj.circle_area(15.5)
obj.circle_area(34.47)
end
main()``````

#### Output

``````Circle Radius  : 63 , Circle Area  : 12468.981242097889
Circle Radius  : 15.5 , Circle Area  : 754.7676350249478
Circle Radius  : 34.47 , Circle Area  : 3732.7803865757082
``````
``````/*
Scala program
Calculate area of circle
*/
class CircleArea
{
//Calculate area of circle by given radius
def circle_area(r: Double): Unit = {
//Math PI containing π value nearly 3.141592653589793
var area: Double = Math.PI * (r * r);
//Display the result of circle area
print("Circle Radius : " + r + " , Circle Area : " + area + "\n");
}
}
object Main
{
def main(args: Array[String]): Unit = {
var obj: CircleArea = new CircleArea();
//Test Cases
obj.circle_area(63);
obj.circle_area(15.5);
obj.circle_area(34.47);
}
}``````

#### Output

``````Circle Radius : 63.0 , Circle Area : 12468.981242097889
Circle Radius : 15.5 , Circle Area : 754.7676350249478
Circle Radius : 34.47 , Circle Area : 3732.7803865757082``````
``````/*
Swift program
Calculate area of circle
*/
class CircleArea
{
//Calculate area of circle by given radius
func circle_area(_ r: Double)
{
//Double.pi containing π value nearly 3.141592653589793
let area: Double = Double.pi * (r * r);

//Display the result of circle area
print("Circle Radius : ", r ," , Circle Area : ", area ,"\n", terminator: "");
}
}
func main()
{
let obj: CircleArea = CircleArea();
//Test Cases
obj.circle_area(63);
obj.circle_area(15.5);
obj.circle_area(34.47);
}
main();``````

#### Output

``````Circle Radius :  63.0  , Circle Area :  12468.9812420979
Circle Radius :  15.5  , Circle Area :  754.767635024948
Circle Radius :  34.47  , Circle Area :  3732.78038657571``````

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

### New Comment 