Program :

Write  C++  program that performs the following steps:

a. Assigning value to the radius r.

b. Calculating the circumference using the formula: C = 2 X Pi X r.

c. Displaying the circumference.


CODE:

#include <iostream>

using namespace std;

int main()
{
    double r,c,Pi=3.14;
    cout << "Enter the Radius :" ;
    cin >> r;

    c = 28 * r * Pi;
    cout << "Circumference is : " << c << endl;

    return 0;

}

Output :


Write  C++  program that performs the following steps:  a. Assigning value to the radius r.  b. Calculating the circumference using the formula: C = 2 X Pi X r.  c. Displaying the circumference.

Reactions:

Post a Comment

 
Top