modify the above function to take a third parameter called shape type.shape type should be either triangle or rectangle based on shape,it should calculate the area. Formula used:
Area of a rectangle=length*width
Answers
Answered by
3
Answer:
sorry dear I am very sorry
Answered by
2
Answer:
// CPP program to find area
// and perimeter of rectangle
#include<bits/stdc++.h>
using namespace std;
// Utility function
int areaRectangle(int a, int b)
{
int area = a * b;
return area;
}
int perimeterRectangle(int a, int b)
{
int perimeter = 2*(a + b);
return perimeter;
}
// Driver program
int main()
{
int a = 5;
int b = 6;
cout << "Area = " << areaRectangle(a, b) << endl;
cout << "Perimeter = " << perimeterRectangle(a, b);
Similar questions
Math,
4 months ago
Math,
4 months ago
Math,
4 months ago
Math,
9 months ago
Social Sciences,
1 year ago