Computer Science, asked by abialjose16, 7 months ago

write a c++ program to find area of a rectangle

Answers

Answered by sougatap57
3

Answer:

#include <iostream>

using namespace std;

int main()

{

  float area,b,l;

  cout<<"enter the length and breadth";

  cin>>l>>b;

  area=l*b;

  cout<<"the area is="<<area;

  return 0;

}

Output:

enter the length and breadth 5 6

the area is = 30

Answered by ishwaryam062001
1

Answer:

c++ program to find area of a rectangle

Explanation:

From the above question,

Step 1: Start

Step 2: Declare the function to calculate area of a rectangle

Step 3: Read the length and breadth of the rectangle

Step 4: Calculate the area by multiplying length and breadth

Step 5: Print the area

Step 6: Stop

#include <iostream>

using namespace std;

// Function to calculate the area of a rectangle

int area(int length, int breadth)

{

   return length * breadth;

}

int main()

{

   int l, b;

   cout << "Enter the length of the rectangle: ";

   cin >> l;

   cout << "Enter the breadth of the rectangle: ";

   cin >> b;

   cout << "Area of the rectangle is: " << area(l, b) << endl;

   return 0;

}

For more such related questions : https://brainly.in/question/32667309

#SPJ2

Similar questions