Write a C++ program to find the area and perimeter of rectangle ( Formula A=l*b and P=2*(l+b)
Answers
Answered by
0
Question
1. ਵਿੰਡੋਜ਼ ਐਕਸਪਲੋਰਰ ਦੇ ਭਾਗਾਂ ਦੀ ਸੂਚੀ ਬਣਾਓ ।
Answered by
12
Structure of C++ Program :
// Comment line
#include <iostream>
using namespace std ;
int main ( )
{
........
Body of Program ;
............
return 0 ;
}
Required C++ Program :
#include <iostream>
using namespace std ;
int main ( )
{
float length , breadth , peri , area ;
cout << " Enter the length and breadth of rectangle : " ;
cin >> lenght >> breadth ;
Peri = 2 * ( length + breadth ) ;
Area = length * breadth ;
cout << "Perimeter = " <<peri << endl ;
cout << " Area = " <<area <<endl ;
return 0 ;
}
Output :
Enter the length and breadth of rectangle = 10 2
Perimeter = 24
Area = 20
Similar questions
English,
2 months ago
Physics,
2 months ago
Computer Science,
2 months ago
Social Sciences,
5 months ago
History,
5 months ago
Physics,
11 months ago
Social Sciences,
11 months ago