- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program for Area Of Square in C++
We are given with a side of a rectangle and our task is to print the area of the square from that side.
Square is 2-D plain figure which have 4 sides and forms 4 angles of 90degree each and all the sides are of equal shape. In other words we can say that the square is a form of rectangle with equal sides.
Given below is representation of a square −
The Area of square is Side x Side
Example
Input: 6 Output: 36 As the side is 6 so the output is 6*6=36 Input: 12 Output: 144
Algorithm
START Step 1-> Declare a function int area(int side) In function area Declare a variable area and set it as side * side Return area End Step 2 -> Declare a function int main() In main Function Declare a variable side and Set a Value Call function area(side) End STOP
Example
#include <iostream> using namespace std; //funcion to calculate area of square int area(int side){ int area = side * side; return area; } // Driver Code int main(){ int side = 40; cout <<"area of square is :"<<area(side); return 0; }
Output
area of square is :1600
- Related Articles
- C++ Program for Area Of Square after N-th fold
- Area of a leaf inside a square in C Program?
- C Program for Area of a square inscribed in a circle which is inscribed in a hexagon?
- Program for Surface area of Dodecahedron in C++
- Program for Surface Area of Octahedron in C++
- Java Program to Find Area of Square
- Swift Program to Find Area of Square
- Kotlin Program to Find Area of Square
- C Program for Area And Perimeter Of Rectangle
- Swift Program to Calculate Area of Circle Inscribed in Square
- Program for Volume and Surface Area of Cube in C++
- Program for Volume and Surface Area of Cuboid in C++
- Java program to find the area of a square
- Haskell Program to Find the Area of a Square
- Area of a square from diagonal length in C++

Advertisements