Begin7. Find the length of the circle \(L\) and the area of the disc \(S\) of a given radius \(R\):
\(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 math
import random
R = random.randrange(1,10)
print("Radius of the circle R = ", R)
print("Pi = ", math.pi)
L = 2 * math.pi * R
print("Length of the circle L = ", L)
S = math.pi * R**2
print("Area of the disk S = ", S)
Solution in C++:
#include <iostream>
using namespace std;
int main(){
double r, pi = 3.14, l, s;
cout << "Enter the radius of the circle: ";
cin >> r;
l = 2*pi*r;
s = pi*r*r;
cout << "Length of the circle: " << l << endl;
cout << "Area of the disk: " << s;
return 0;
}