Begin14. The length \(L\) of the circle is given. Find its radius \(R\) and the area \(S\) of the circle bounded by this circle, taking into account that \(L = 2 \cdot \pi \cdot R, \quad S = \pi \cdot R^2\) . For the value of \(\pi\) use 3.14.
Solution in Python 3:
import random
import math
print("Pi:", math.pi)
L = random.randrange(1,100)
print("Length of the circle: ", L)
R = L / 2 / math.pi
S = math.pi * R**2
print("Radius of the circle: ", R)
print("Area of the circle (disk): ", S)
Solution in C++:
#include<iostream>
using namespace std;
int main(){
double l,r,s, pi = 3.14;
cout << "Enter the length of the circle: ";
cin >> l;
r = l/(2*pi);
s = pi*r*r;
cout << "Radius: " << r << endl;
cout << "Area': " << s;
return 0;
}