Area of Circle Example C++ Program in C++
On this page (6sections)
About this program
This is an example program in c common example program. Read the concept first: C++ Variables and Data Types, then study the code and output below.
Definition
The area of a circle is π (Pi) times the Radius squared, which is written A=πr2.
Formula
The area of a circle is written
A=πr2
here,
r = Radius
π = ~3.14
Area Of Circle Example Program
/*##Area Of Circle In C++*/
/*##Calculation C++ Programs, Datatype C++ Programs, Basic C++ Programs*/
#include <iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int main(){
// Declare Variables
float radius, area;
cout << "Simple C++ Program : Area Of Circle\n";
cout <<"\nEnter the radius of Circle : ";
cin>>radius;
area = 3.14 * radius * radius;
cout <<"\nArea of Circle : "<<area;
getch();
return (0);
}
Sample Output
Simple C++ Program : Area Of Circle
Enter the radius of Circle: 2.0
Area of Circle:12.57
Related Pages
Learn the concept first, then study the code:
- C++ Programs — Browse all C++ Programs.
- C++ Variables and Data Types — Tutorial — data types and variable declaration.
- Factorial Using Loop Example Program In C++ — More in c common example program.
- Factorial Using Function Example Program In C++ — More in c common example program.