Skip to main content

Area of Square Example C++ Program in C++

1 min read
Share:
On this page (6sections)

About this program

This is an example program in c common example program. Read the concept first: C++ Variables and Data Types, then study the code and output below.

Definition

In classical times, the second power was described in terms of the area of a square, as in the above formula. This led to the use of the term square to mean raising to the second power. Thus the area of the square is twice the length of the square.

Area Of Square Formula

The area of a rectangle is written as,
A=s^2
here,
A=Area
s=side of the square

Area Of Square Example Program

/*## Area Of Square In C++*/
/*##Calculation C++ Programs, Datatype C++ Programs, Basic C++ Programs*/

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

using namespace std;

int main() {
   // Declare Variables
   float length, area;

   cout << "Simple C++ Program : Area Of Square\n";
   cout << "\nEnter the Length of Square : ";
   cin>>length;

   area = length * length;
   cout << "\nArea of Square : " << area;

   getch();
   return (0);
}

Sample Output

Simple C++ Program : Area Of Square

Enter the Length of Square : 6

Area of Square : 36

Learn the concept first, then study the code:

Related Tutorials

Search tutorials