04-24-2011, 06:35 PM
Dear Student,
Below is the correct code of the program.
#include <iostream.h>
#include<conio.h>
double circleArea ( double);
int main ( )
{
double rad1 ;
double rad2 ;
double ringArea ;
cout << " Please enter the outer radius value: ";
cin >> rad1 ;
cout << " Please enter the radius of the inner circle: " ;
cin >> rad2 ;
ringArea = circleArea(rad1) - circleArea(rad2);
cout<< " Area of the ring having inner raduis " << rad2 << " and the outer radius " <<rad1 << " is " << ringArea <<endl;
system("pause");
}
double circleArea ( double radius )
{
return ( 3.1415926 * radius * radius ) ;
}
Below is the correct code of the program.
#include <iostream.h>
#include<conio.h>
double circleArea ( double);
int main ( )
{
double rad1 ;
double rad2 ;
double ringArea ;
cout << " Please enter the outer radius value: ";
cin >> rad1 ;
cout << " Please enter the radius of the inner circle: " ;
cin >> rad2 ;
ringArea = circleArea(rad1) - circleArea(rad2);
cout<< " Area of the ring having inner raduis " << rad2 << " and the outer radius " <<rad1 << " is " << ringArea <<endl;
system("pause");
}
double circleArea ( double radius )
{
return ( 3.1415926 * radius * radius ) ;
}
