Pages

Saturday, February 9, 2019

C++ Program to calculate Area of Circle

/*
Following C++ program will calculate Area of Circle for the given radius.
*/

#include <iostream>
using namespace std;

int main()
{
    float radius, area;

    cout << "Enter the radius of circle : ";
    cin >> radius;
    
    area = 3.14 * radius * radius;
    
    cout << "Area of circle with radius "
         << radius << " is " << area;
}

Output of program

Enter the radius of circle : 2
Area of circle with radius 2 is 12.56


No comments:

Post a Comment