Get the FREE certificate on C, C++, Java, Python, Perl, PHP, SQL, Linux & Javascript!  

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

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;
}