Surface Area of Cube || C++ program to find Surface Area of Cube || C++

In this, we are going to see how to find Surface Area of  Cube using C++ program.

The formula to calculate is,

Surface Area of Cube = 6 * side * side 

The Code given below can be used in Turbo C++ Compiler.

#include<iostream.h>
#include<conio.h>

void main()
{
    clrscr();
    float area, side;
    cout<<"This program is for Surface Area of Cube\n";
    cout<<"Enter the length of the side of the cube\n";
    cin>>side;

    //formula for surface area of cube is 6 x side^2
    area = 6*side*side;
    cout<<"The Area of the cube with side "<<side<<" is = "<<area<<" sq units";
    getch();
}

    
    

The Code given below can be used in g++/gcc Compiler.

#include<iostream>
using namespace std;

int main()
{
    float area, side;
    cout<<"This program is for Surface Area of Cube\n";
    cout<<"Enter the length of the side of the cube\n";
    cin>>side;

    //formula for surface area of cube is 6 x side^2
    area = 6*side*side;
    cout<<"The Area of the cube with side "<<side<<" is = "<<area<<" sq units";
    return 0;
}

    
    

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post