Back To C User Defined Functions Index
//program to create a function that returns volume of box based on width,depth and height passed to function as integer arguments #include
#include
int volume(int,int,int); int volume(int width,int depth,int height) { float vol; vol=width*depth*height; return vol; } void main() { int width,depth,height; int vol; clrscr(); printf("enter width of box"); scanf("%d",&width); printf("enter depth of box"); scanf("%d",&depth); printf("enter height of box"); scanf("%d",&height); vol=volume(width,depth,height); printf("volume of box is %d",vol); getch(); }