Write a function to calculate volume of a box with appropriate default values for its parameters.Your function should have the following input parameters: a) Length of box b) Width of box c) Height of box Test it by writing a complete program to invoke it. Immersive Reader
Answers
Answered by
1
Answer:
Explanation:
import java.util.*;
public class volume
{
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
System.out.println("Enter the length, width and height of box: ");
int l = s.nextInt();
int w = s.nextInt();
int h = s.nextInt();
int v = voume(l,w,h);
System.out.println("The volume of the box is:");
}
public static int volume(int l=5,int w=10,int h=3)
{
return (l*w*h);
}
}
Answered by
5
Answer:
def vol(l=1,b=1,h=1):
vol=l*b*h
return vol
v1=vol(3)
v2=vol(25,h=20)
v3=vol(h=20,l=10)
print(v1)
print(v2)
print(v3)
Hope it helps you ☺☻☺
Similar questions