Answer to Question #128506 in C++ for Ali Rizwan

Question #128506
Write a function called circarea() that finds the area of a circle. It should take an argument of type float and return an argument of the same type. Write a main() function that gets a radius value from the user, calls circarea(), and displays the result.
1
Expert's answer
2020-08-05T16:46:51-0400
#include <iostream>

const float PI = 3.1415926;

float circarea(float r)
{
	return PI * r * r;
}

int main()
{
	float radius;
    std::cout << "Enter circle radius : ";
	std::cin >> radius;
	std::cout << "Circle area = " << circarea(radius) << "\n";
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS