C Program Volume Of Cylinder | C Programs

How to find and calculate the C program for volume of cylinder. If you ever wonder on how to calculate the volume of cylinder, then you can check out our article here. You will get an idea. Also, make sure to subscribe to my blog.

Using Standard

1)We need radius and height for calculate the volume of cylinder.

2)The radius and height values will store into the variables “r”,”h”.

3)The calculated volume will store into the variable “vol”.

output:

Using Function

1)Here we are using the float volume(float r,float h) function to calculate the volume of cylinder.

2)We are calling the function using the code v=volume(r,h).

3)The  function volume(float r,float f) will calculate the volume and return the value,the return value will assigned to

variable “v”.

output:

Using Pointers

1)We are passing the references/addresses using volume(&r,&h,&v) to the function volume(float *r,float *h,float *a)

which is having pointer variables as arguments.

2)The function volume(float *r,float *h,float *a) will calculate the volume and that value assigned to the variable pointer variable “a”

output:

Using Macros

1)The 2nd line represents volume(r,h) is symbolic name to the expression (22*r*r*h)/7.

2)volume(r,h)replaced with that expression given at #define.

output:

That’s how you find or calculate the volume of cylinder C Program

Add a Comment

Your email address will not be published. Required fields are marked *