Answer to Question #327009 in C++ for roken

Question #327009

Write a C++ program to calculate area and perimeter of square and rectangle using function.

Output Example should be

Enter Side of a square: 4

Enter Length and Breadth of Rectangle: 3 6


The Area of a square is: 16

The Area of Rectangle is: 18

The Perimeter of a Square is: 16

The Perimeter of a rectangle is 18


1
Expert's answer
2022-04-11T07:45:41-0400
#include <iostream>

using namespace std;

int main()
{
	float sideOfsquare;
	float lengthR, breadthR;
	cout << "\nEnter Side of a square: ";
	cin>> sideOfsquare;
	cout << "\nEnter Length and Breadth of Rectangle: ";
	cin>> lengthR>>breadthR;
	cout << "\nThe Area of a square is: " << sideOfsquare*sideOfsquare;
	cout << "\nThe Area of Rectangle is: "<< lengthR * breadthR;
	cout << "\nThe Perimeter of a Square is: " << sideOfsquare * 4;
	cout << "\nThe Perimeter of a Rectangle is: " << (lengthR + breadthR) * 2;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Akpese
14.02.23, 02:50

The best

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS