Write a program that calls a udm to calculate the area of a rectangle.
In the main method, ask user to enter two numbers. Call the calArea method to
return the area of the rectangle. calArea accepts two double and returns the area
as a double, formatted in two decimal places.
#include<bits/stdc++.h>
using namespace std;
void calArea()
{
double l , b, area;
cout<<"Enter the Length: ";
cin>>l;
cout<<"Enter the Breadth: ";
cin>>b;
area = l * b;
cout<<"Area of Rectangle is : "<<area;
}
int main()
{
calArea();
}
Comments
Leave a comment