Saturday, June 19, 2021
Home coding Write a program to find the area of circle.

Write a program to find the area of circle.

Given a radius of circle , we have to find the area of circle and print the area of circle.

So what is area of circle ?

area of circle is 3.14 * radius * radius;

Example:

Input:5
Output:78.5

Logic:

STEP 1: radius r of circle. is given already. we have to find the area
STEP 2:area=3.14*r*r;
STEP 3:print the area

Code

#include<bits/stdc++.h>
using namespace std;
int main()
{
    cout<<"enter radius "<<endl;
double r;
cin>>r;
double area=3.14*r*r;
cout<<"area" << " "<<area<<endl;
}

Ouput:

5
78.5

Time Complexity:O(N)

Space Complexity:O(1)

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments