To calculate the volume of Cube you need to know the side of the cube.
Variables:
1. side : (Datatype int) : to represent the side a cube.
2. volume_of_cube : (Datatype long) : to store the volume of cube result.
Functions:printf() : is used to display something on the console/screen. Format specifier %d in printf function is used to display an int variable on screen and %ld for long. \n is used to add a new line
scanf(): is used to fetch data inputted by the user on the console/screen using the keyboard. %d in scanf is indicated that inputted text is of type int and %ld for long.
/*
* 1000+ C programs + tutorials
*
*
* 9_calculate_volume_of_cube.c
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include <stdio.h>
//#include <conio.h>
void main() {
int side;
long volume_of_cube;
// clrscr();
printf(" Program to calculate Volume of a Cube : \n\n");
printf(" Enter the side of cube : ");
scanf("%d", &side);
volume_of_cube = side*side*side;
printf("\n\n Volume of Cube with Side as %d = %ld ",side, volume_of_cube);
// getch();
}
Formula:
The volume of Cube : (side)3
Output:Program to calculate Volume of a Cube:
Enter the side of the cube: 40
The volume of Cube with Side as 40 = 64000
Program to calculate Volume of a Cube:
Enter the side of the cube: 10
The volume of Cube with Side as 10 = 1000
More Posts related to C-program,
- Calculate Volume of Cylinder
- Calculate Volume of Sphere
- Calculate Volume of Cube
- Calculate Volume of Ellipsoid
- Find Sum of two numbers
- Division between two numbers
- Calculate Area of Trapezoid
- Calculate Area of a Rectangle
- Calculate Volume of Pyramid
- Calculate Area of ellipse
- Find Difference of two numbers
- Calculate Volume of Cone
- Calculate Area of Square
- Calculate Area and Circumference of Circle
- Calculate Area of Parallelogram
More Posts:
- Fetch More then 10 Links Per Page in Google Search Result - Google
- Android Studio: Cannot perform refactoring operation - Android-Studio
- eclipse maven m2e : Cannot complete the install - Eclipse
- Top 3 Awesome Text Editors developers prefer at workplace - Sublime
- Calculate Area of a Rectangle - C-Program
- What is Bootstrap Jumbotron and how to use it - Bootstrap
- Background task activation is spurious error - Windows 10, Office 2016, Office 365 - HowTos
- How to remove old 404 pages ulrs from Google crawler - Html
- Exception in thread main java.lang.NoClassDefFoundError: package javaClass - Java
- SharePoint Server 2016 error Microsoft Office Online Server 2016 cant be installed on the same machine as a Microsoft SharePoint Server product - SharePoint
- 7 deadly java.lang.OutOfMemoryError in Java Programming - Java
- How to Print from JavaScript HTML using window.print - JavaScript
- Unable to establish connection to adb : Android Studio Error - Android
- How to send WhatsApp message from your Android App using Intent - WhatsApp
- Portable Notepad++ for windows - NotepadPlusPlus