C++ Chapters

C++ Program to Calculate Area of Rectangle

Structure of C++ Programs - Overview
#include <iostream>
using namespace std;

int main()
{
    float Length, Width, Area;
    
    cout << "Enter Length of Rectangle : ";
    cin >> Length;
    
    cout << "\nEnter Width of Rectangle : ";
    cin >> Width;
    
    Area = Length * Width;
    
    cout << "\n\nArea of Rectangle is : " << Area;
    
    return 0;
}

Output :
Enter Length of Rectangle : 10
Enter Width of Rectangle : 20

Area of Rectangle is : 200

Description :

In above example Width & Length of Rectangle are to be entered by user and then area of Rectangle is calculated As
Area = Length x Width


Leave a comment
Recent Comments
No Comments