C Tutorial
This c program is used to find the volume of a cube and length is provided as the user input.
Volume of a cube = length × length × length
// Finds volume of a cube #include<stdio.h> void main() { int length; float volume=0; printf("\nFinds volume of a cube\n-------------------"); printf("\nEnter length of one side: "); scanf("%d", &length); volume = (length*length*length); printf("Volume of a cube is: %.2f", volume); }
Output:
$ cc volume-of-cube.c $ ./a.out Finds volume of a cube ------------------- Enter length of one side: 6 Volume of a cube is: 216.00
C Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page