Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Combinatorial Testing In Cloud Computing

Authors: Wei-Tek Tsai ,Guanqiu Qi

1st Edition

9811044805, 978-9811044809

More Books

Students also viewed these Programming questions