C++ Program to Find Curved Surface Area of a Cube
Last Updated :
07 Apr, 2023
A cube is a 3-dimensional box-like figure represented in the 3-dimensional plane. Cube has 6 squared-shape equal faces. Each face meets another face at 90 degrees each. Three sides of the cube meet at the same vertex. The curved surface area of a cube is the sum of the areas of all its faces, except its top and bottom faces. Hence, the curved surface area of the cube is the sum of areas of all four side faces of a cube.
Input: Side of the cube =2
Output: Curved Surface area = 16
Curved Surface Area of a cube is: 4 * a * a
where, a is the side of the cube
C++
#include <bits/stdc++.h>
using namespace std;
double CurvedareaCube( double a)
{
return (4 * a * a);
}
int main()
{
double a = 2;
cout << "Curved surface area = " << CurvedareaCube(a);
return 0;
}
|
Java
import java.io.*;
class GFG {
static double CurvedareaCube( double a)
{
return 4 *a*a;
}
public static void main (String[] args) {
double a = 2 ;
System.out.println( "Curved surface area = " +CurvedareaCube(a));
}
}
|
Output
Curved surface area = 16
Time Complexity: O(1)
Auxiliary Space: O(1)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...