A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a program in C++ to print the area and perimeter of a rectangle
Q:

Write a program in C++ to print the area and perimeter of a rectangle

0

Write a program in C++ to print the area and perimeter of a rectangle

Sample Output:

  Print the area and perimeter of a rectangle:                          
----------------------------------------------                         
 Input the width of the rectangle: 8.5                                 
 Input the height of the rectangle: 5.6                                
The area of the rectangle is: 47.6                                     
The perimeter of the rectangle is: 28.2

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
using namespace std;
 
int main()
{
float ar,peri,width,height=0;
    cout << "\n\n Print the area and perimeter of a rectangle:\n";
	cout << "----------------------------------------------\n";
	cout << " Input the width of the rectangle: ";
	cin>> width;
	cout << " Input the height of the rectangle: ";
	cin>> height;	
	peri=2 * (width+height);
	ar= height * width;
	cout<<"The area of the rectangle is: "<<ar<<"\n";
	cout<<"The perimeter of the rectangle is: "<<peri<<"\n";
	
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now