Table of Contents
Program to Find Area of Circle
Algorithum
C Language
C++
Python
JS
Algorithum
Start
Let the Radius of the Circle be x
According to the Question area of a circle, the formula is πr2 where π=3.14 or 22/7
3.14*r*r
Display Result
Stop
C Language
//Program to print the Area of Circle in C language
#include "stdio.h"
#include "conio.h"
main()
{
float r, a; //where r is radius,a is area
printf("Enter radius of circle\n");
scanf("%f", & r);
a = 3.14* r * r;
printf("Area of circle : %f ", a);
}
C++
//Write the Program to Print the Area of Circle in c++
#include
main()
{
float r, a; //where r is radius,a is area
cout << "Enter the radius of circle : ";
cin >> r;
a= 3.14 * r * r;
cout << "Area of circle is " << a;
}
Python
#program to find area of circle in Python Program
PI = 3.14
r = float(input("Enter the radius of a circle:"))
a = PI * r * r #a is area of circle and r is a radius
print("Area of a circle =",a)
JS
<!DOCTYPE html>
<html>
<body>
<h1>Enter the radius of a circle:</h1>
<input id="n1" value="2" />
<p id="d1"></p>
<script>
var pi=3.14,r;
r= Number(document.getElementById("n1").value);
r=pi*r*r;
document.getElementById("d1").innerHTML ="your area of circle result is " + r;
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>Enter the radius of a circle:</h1>
<input id="n1" value="2" />
<script>
var pi=3.14,r;
r= Number(document.getElementById("n1").value);
r=pi*r*r;
alert(r);
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>Enter the radius of a circle:</h1>
<input id="n1" value="2" />
<button onclick="circle()">click me </button>
<p id="d1"></p>
<script>//function define
function circle() {
var pi=3.14,r;
r= Number(document.getElementById("n1").value);
r=pi*r*r;
document.getElementById("d1").innerHTML ="your area of circle result is " + r;
}
</script>
</body>
</html>