C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Program to find the volume of the cube
Volume of a cube = side * side * side. The cube has all the edges of the same length. The volume of a cube can be calculated by multiplying the length of an edge by itself twice. So if the length of an edge is 4, the volume is 4 x 4 x 4 = 64 Algorithm
ComplexityO(1) SolutionC Program#include Output: Volume of the cube=64 PHP Program
<?php
$a=4;
$volume=$a*$a*$a;
echo "Volume of the cube=";
echo $volume;
?>
Output: Volume of the cube=64 Java Program
public class cube{
public static void main(String args[])
{
int a=4;
int volume=a*a*a;
System.out.println("Volume ot the cube="+volume);
}
}
Output: Volume ot the cube=64 C# Program
using System;
public class Program
{
public static void Main()
{
int a=4;
int volume=a*a*a;
Console.WriteLine("Volume of cube="+volume);
}
}
Output: Volume of cube=64 Python Program
a=4
volume=a*a*a
print("volume of the cube="+str(volume))
Output: volume of the cube=64
Next Topic#
|