Begin9. Two nonnegative numbers \(a\) and \(b\) are given. Find their geometric mean, that is, the square root of their product: \(\sqrt{a \cdot b}\).

Solution in Python 3:

import random
import math

a = random.randrange(1,10)
b = random.randrange(1,10)
print("a = ", a)
print("b = ", b)
print("Geometric mean: ", math.sqrt(a*b))

Solution in C++:

#include <iostream>
#include <cmath>
using namespace std;
int main(){
double a,b,c;
cout << "Enter the number a: ";
cin >> a;
cout << "Enter the number b: ";
cin >> b;
c = sqrt(a*b);
cout << "Geometric mean: " << c;
return 0;
}