Cube is a 3-dimensional box-like figure represented in the 3-dimensional plane. Cube has 6 squared-shape equal faces. Each face meet another face at 90 degree each. Three sides of cube meet at same vertex.
Input : Side of a cube = 2
Output : Area = 8
Total surface area = 24
Input : Side of a cube = 3
Output : Area = 27
Total surface area = 54
document.write( "Total surface area = "+ surfaceCube(a));
// This code is contributed by gauravrajput1
Area = 125
Total surface area = 150
Time complexity : O(1) Auxiliary Space : O(1)
This article is contributed by Saloni Gupta . If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Please Login to comment...