Begin13. Two circles with the common center and radiuses \(R_1\) and \(R_2\) (\(R_1> R_2\)) are given. Find the areas of these circles \(S_1\) and \(S_2\), and also the area \(S_3\) of a ring which outer radius is \(R_1\), and the inner radius is \(R_2\):
\(S_1 = \pi \cdot (R_1)^2, \quad S_2 = \pi \cdot (R_2)^2, \quad S_3 = S_1 - S_2.\)

Solution in Python 3:

import random
import math

print("Pi:", math.pi)
R1 = random.randrange(2,10)
R2 = random.randrange(1,R1)
print("Radius 1: ", R1)
print("Radius 2: ", R2)
S1 = math.pi * R1**2
S2 = math.pi * R2**2
S3 = S1 - S2
print("Area of the circle 1: ", S1)
print("Area of the circle 2: ", S2)
print("Area of the ring: ", S3)

Solution in C++:

#include<iostream>
#include<cmath>
using namespace std;
int main(){
double r1,r2,s1,s2,s3,pi=3.14;
cout << "Enter the 1st radius: ";
cin >> r1;
cout << "Enter the 2nd radius: ";
cin >> r2;
s1 = pi*r1*r1;
s2 = pi*r2*r2;
s3 = abs(s1-s2);
cout << "Area of the circle 1: " << s1 << endl;
cout << "Area of the circle 2: " << s2 << endl;
cout << "Area of the ring: " << s3;
return 0;
}