|
#include <iostream.h>
main ()
{
//declare variables
float radius,
diameter, circumference, area;
// prompt the user
for radius of a circle
cout <<
"Please enter the radius of the circle
" ;
cin >> radius
;
//calculate the
diameter, circumference and area of the circle
//implementing
formula i.e. circumference = 2 ח r and area = ח r2
diameter = radius *
2 ;
circumference = 2 *
3.14 * radius ; // 3.14 is the value of ח (Pi)
area = 3.14 * radius
* radius ;
//display the
results
cout <<
"The diameter of the circle is :
" << diameter << endl ;
cout <<
"The circumference the circle is :
" << circumference << endl ;
cout <<
"The area of the circle is :
" << area ;
}
|