Calculate Volume of Cone


Variables:

1. height : (Datatype int) : to represent the height of Cone.

2. radius : (Datatype int) : to represent the radius of Cone.

3. PI : (Datatype float) : static variable to represent constant PI value upto 3 decimal places i.e 3.142

5. volume_of_cone : (Datatype float) : to store volume of Cone calculated.

Formula :Volume of a Cone : π x r2x h

/*
 * 1000+ C programs + tutorials
 *
 *
 * 12_calculate_volume_of_cone.c
 *
 *
 *  Created on: Oct 20, 2014
 *  Author: Code2care.org
 */

#include <stdio.h>
//#include <conio.h>

void main() {

    int height;
    int radius;
    float volume_of_cone;
    float PI = 3.142;

//	clrscr();

	printf(" Program to calculate Volume of a Cone :  ");

	printf("\n\n Enter the Radius of Cone : ");
	scanf("%d", &radius);
    
    printf("\n\n Enter the Height of Cone : ");
	scanf("%d", &height);
    
    
    volume_of_cone = PI*radius*radius*height;


	printf("\n\n Volume of Cone with Radius as %d and Height as %d = %f",radius,height,volume_of_cone);

//	getch();



}
Output :

Program to calculate Volume of a Cone :
Enter the Radius of Cone: 2
Enter the Height of Cone: 5
The volume of Cone with Radius as 2 and Height as 5 = 62.840000

Programs are divided into categories depending upon type and complexity.

BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.






Hello there!,

You are using AdBlocker!

I am an independent developer trying to help fellow developers and students to resolve issues faced on a day-to-day basis, we 'Code to Care' . There is a lot of expenses involved in hosting and managing a website that's the reason we have ads.

A humble request to you to disable adBlocker on Code2care.org and support us pay our bills.

Thanks,
Cod2care - Line's of code for change.

To see contents reload page after unblocking
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities. Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, Tips-n-tricks, How Tos, Blogs, Articles, etc. on various platforms like Windows, Mac, Linux, Mobile platforms, etc. Technologies/Languages like Java, Objective-C, PHP, .Net, Android, SharePoint, jQuery, HTML, CSS, etc.