Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function float circle.area(float r), which takes a radius value and calculates the area of a circle. The correct formula is Pi'r'r, where you
Write a function float circle.area(float r), which takes a radius value and calculates the area of a circle. The correct formula is Pi'r'r, where you can assume that PI=3.1415. You should check if the value for radius is strictly positive. If not, you should return -1
HINT: You should return the value, not printing it.
For example:
Test Output
printf("$.41", circle area (14.5)) 660.5004
printf("%.4f", circle area(-10)) -1.0000
printf("%.4f", circle area(0)) -1.0000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started