Допоможіть з програмуванням С++
Обчислити довжину кола і площу круга за заданим діаметром
(задавши вхідні дані самостійно)
Дякую :)
flash77779:
Відповів
Ответы
Ответ дал:
1
#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;
}
Приложения:
Вас заинтересует
1 год назад
3 года назад
8 лет назад