Begin4. The diameter of the circle \(d\) is given. Find its length \(L = \pi \cdot d\). For the value of \(\pi\) use 3.14.

Soution in Python 3:

import math
import random

d = random.randrange(1,10)
print("Diameter of the circle d = ", d)
print("Pi = ", math.pi)
L = math.pi * d
print("Length of the circle L = ", L)

Solution in C++:

#include<iostream>
using namespace std;
int main(){
double d, pi = 3.14, l;
cout << "Enter the diameter of the circle: ";
cin >> d;
l = pi*d;
cout << "Length of the circle: " << l;
return 0;
}