CppBuzz.com
  
Home C C++ Java Python Perl PHP SQL Javascript Linux Forum

You are here : Home » Solved Programs on C++ » Program to calculate area of rectangle

C++ Program to calculate area of rectangle

#include<iostream>
using namespace std;

float area(float length, float width){
    return (length*width);
}

int main()
{
float length, width, rec_area;

cout<<"\n Enter Length : ";
cin>>length;

cout<<"\n Enter Width : ";
cin>>width;

rec_area = area(length, width);

cout<<"\n Area of Rectangle is : "<< rec_area;

return 0;
}