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