Question #124370

3. Write a program that computes the area of a circular region (the shaded area in the diagram) given the radius of the inner and the outer circles, ri and ro, respectively.










We compute the area of the circular region by subtracting the area of the inner circle from the area of the outer circle.

Expert's answer

#include <iostream>
#include <cmath>


using namespace std;


int main(){
    double s, ri, ro;


    cout << "Input ri: "; cin >> ri;
    cout << "Output ro: "; cin >> ro;
    s = M_PI * (ro * ro - ri * ri);
    cout << "Answer: " << s;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS