Question: 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
Get step-by-step solutions from verified subject matter experts
