Explore BrainMass
Share

Explore BrainMass

    How to calculate the area and volume of a Cylinder using C

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a library Cylinder containing functions to compute the total surface area, lateral surface area, and volume of a right-circular cylinder. For a cylinder of radius r and height h, these can be calculated using:
    Total Surface Area = 2 x Pi r(r + h)
    Lateral Surface Area = 2 x Pi rh
    Volume = Pi r squared h

    Write a driver program to test your library.

    © BrainMass Inc. brainmass.com October 9, 2019, 4:24 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/calculate-area-volume-cylinder-31579

    Solution Preview

    First compile the library file
    gcc -c cylinder.c
    this will ...

    Solution Summary

    This solution teaches how to write a C library function that calculates the following functions for a Cylinder.
    a) Total Surface Area
    b) Lateral Surface Area
    c) Volume
    It also teaches how to compile the C library and how to use a C driver program to use the compiled C library.
    Includes header file and .c program files.

    $2.19