C Program To Find Volume Of Cone | C Programs

Here is the program to calculate the volume of cone using standard, macros, pointers. Do check it out. We do also added the sample output for each example program so that you can easily get through  it.

Using Standard

1)We are using the standard formula for calculating the volume of cone ,Here we need radius and height of cone.

2)The values of radius and height will store in to the variables “radius” and “height” ,these values substitute into the formula we will get volume of cone,that value will store into  variable “volume”.

output:

Using Functions

1)Here volume(r,h)is calling function,and volume(float r,float h) is called function.

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

3)The called function volume(float r,float h) calculate the volume and returns the value, that value will store into variable “v”.

output:

Using Pointers

1)Here *r,*h,*v are the pointer variables

2)We are calling the function using volume(&r,&h,&v) by passing addresses as arguments.

3)The called function volume(float *r,float *h,float *v) will calculate the volume ,that volume value will store into  pointer variable v.

output:

Using Macros

1)volume(r,h) is symbolic name to the formula  (22*r*r*h)/(3*7)

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

output:

Add a Comment

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