Calculate Area and Perimeter of Rectangle in C++

Advertisements

Prev Tutorial Next Tutorial

C++ Program to Calculate Area and Perimeter of Rectangle

To calculate area and perimeter of a square and rectangle we need length and breadth of the rectangle. First we receiver two variable from user using Cin>> function. and print output on screen using cout>> function

To understand below example, you have must knowledge of following C++ programming topics; Cin and Cout Function in C++ Here Cout<< Function in C++ are used for print output on screen and Cin>> function in C++ are used for get input from user.

C++ Program to Calculate Area and Perimeter of Rectangle

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

void main()
{
 clrscr();
 int len, bre, peri, area;
 cout<<"Enter Length and Breadth of the Rectangle: ";
 cin>>len>>bre;
 area=len*bre;
 peri=(2*len)+(2*bre);
 cout<<"Area of Rectangle: "<<area<<"\tPerimeter Rectangle: "<<peri;
 getch();
}

Output

Enter Length and Breadth of the Rectangle: 10 20
Area Rectangle: 200
Perimeter Rectangle: 60
c++ program to calculate area and permeter of rectangle
Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements