#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double diameter, radius, length, area;
const double PI = 3.14159;
cout << "Enter the diameter of the circle: ";
cin >> diameter;
radius = diameter / 2;
length = 2 * PI * radius;
area = PI * pow(radius, 2);
cout << "The length of the circle is " << length << endl;
cout << "The area of the circle is " << area << endl;
return 0;
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double diameter, radius, length, area;
const double PI = 3.14159;
cout << "Enter the diameter of the circle: ";
cin >> diameter;
radius = diameter / 2;
length = 2 * PI * radius;
area = PI * pow(radius, 2);
cout << "The length of the circle is " << length << endl;
cout << "The area of the circle is " << area << endl;
return 0;
}