Search for question
Question

2. Write a C function using Replit that calculates and returns the volume of a cylinder: V=⭑r²⭑h Where is the volume, is the radius, and h is the height of the cylinder. It can be estimated as 3.1415. Your function should take as input two floating-pointing arguments: r and h. Your function should check whether r and h are greater than 0, and if either of them are not greater than 0, print an error message and return -1; otherwise, your function should continue with the calculation and return the result as a floating-point value. Call the function from main with a couple of examples, and print the results.

Fig: 1