90 268
Assignments Done
99.4%
Successfully Done
In September 2020

# Answer to Question #48750 in C for muammarmubin

Question #48750
1) Write a program to calculate the area of circles

2) Write a program to convert a distance in miles to kilometers. Given 1 Mile = 1.609 km
1
2014-11-10T10:58:33-0500
/***** The area of circles *******/
#include <cstdlib>
#include <iostream>
using namespace std;
const float pi = 3.14159;

float Area( float r )
{
return pi*r*r; // returns area of the circle
}
int main()
{
cin >> r;
printf("The area of circle is: %3.2f\n", Area(r)); //call of the function and print result
system("PAUSE");
return EXIT_SUCCESS;
}

/***** convert a distance in miles to kilometers *******/
#include <cstdlib>
#include <iostream>
using namespace std;
const float Mile = 1.609;

float Dist( float m )
{
return Mile * m; // returns kilometers
}
int main()
{
cout << "Enter miles: ";
cin >> m;
printf("Distance in kilometers is: %3.3f\n", Dist(m)); //call of the function and print result
system("PAUSE");
return EXIT_SUCCESS;
}

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!