Tuesday, November 30, 2021

Area of Rectangle in C++

 Machine Problem

Write a C++ program that computes for the area of a rectangle. There are two set of measurements given

below Rectangle 1 has a length of 8 and a width of 5. Rectangle 2 has a length of 4 and a width of 20.

Use a user defined function with parameters for this program.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

/*

2. Area of Rectangle

Write a C++ program that computes for the area of a

rectangle. There are two set of measurements given

below

Rectangle 1 has a length of 8 and a width of 5.

Rectangle 2 has a length of 4 and a width of 20.

Use a user defined function with parameters for this

program.

*/

#include <iostream>


using namespace std;


int AreaofRectangle ( int a, int b)

{

    return a * b;

}


int main()

{

  int l1 = 8;

  int w1 = 5;

  int l2 = 4;

  int w2 = 20;


  cout << "Area1 = " << AreaofRectangle(l1, w1) << "\n";

  cout << "Area2 = " << AreaofRectangle(l2, w2) << "\n";

  return 0;

}

No comments:

Post a Comment