Write a program that reads the radius of a circle (as a double value) and computes and prints the diameter, the circumference and the area. Use the value 3.14159 for ?.

What will be an ideal response?


```
// Calculate the diameter, circumference and area of a cirle.
#include
using namespace std;

int main()
{
double radius; // input radius
double pi = 3.14159; // value for pi
// get radius value
cout << "Enter the radius: ";
cin >> radius;

// compute and display diameter
cout << "The diameter is " << radius * 2.0;

// compute and display circumference
cout << "\nThe circumference is " << 2.0 * pi * radius;

// compute and display area
cout << "\nThe area is " << pi * radius * radius << endl;
} // end main
```

Computer Science & Information Technology

You might also like to view...

The program, which is a test to tell computer and humans apart, when filling out a form on the Web is known as a(n) ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

Modular programming helps keep your main program uncluttered and easy to understand.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The * operator is used to perform ____.

A. Addition B. Multiplication C. Division D. Exponentiation

Computer Science & Information Technology

When creating a descriptionmetaelement, the value of the ____ attribute indicates the type of data provided in the element.

A. name B. content C. charset D. type

Computer Science & Information Technology