Dremendo Tag Line

Calculate area of a circle in C++

cin - Question 13

In this question, we will see how to input the radius of a circle in C++ programming using the cin statement and find its area. To know more about cin statement click on the cin statement lesson.

Q13) Write a program in C++ to input the radius of a circle and find its area. Area of a circle is πr2. Where r is the radius and the value of π (pie) is 22/7 or 3.142

Formula: area = 3.142 * r * r

Program

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    float r,a;
    cout<<"Enter radius of a circle ";
    cin>>r;
    a=3.142*r*r;
    cout<<"Area="<<a;
    return 0;
}

Output

Enter radius of a circle 5
Area=78.55
video-poster