Circumference of Circle in C++
Q.Write a C++ program to find the area and circumference of a circle.
#include <iostream>
using namespace std;
int main()
{
float r, a, c;
cout << "Enter the radius of circle: ";
cin >> r;
a =3.14 *r *r;
cout << "Area of circle : " << a << endl;
c=2*3.14*r;
cout << "circumference of circle : " << c;
return 0;
}
Q. Write an algorithm to find the area and circumference of a circle.
1. Start
2. Input: Prompt the user to enter the radius of the circle (`r`).
3. Process:
- Calculate the area of the circle using the formula:
`area (a) = π * r * r`
(Use 3.14 for π)
- Calculate the circumference of the circle using the formula:
`circumference (c) = 2 * π * r`
4. Output :
- Display the calculated area.
- Display the calculated circumference.
5. End
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.
point.com