Write a cpp program to calculate area of a rectangle?
/* This cpp program is for TurboC++ */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int l,b;
cout<<"Enter length: ";
cin>>l;
cout<<"Enter width: ";
cin>>b;
cout<<"Area of rectangle is: "<<l*b;
getch();
}
Ourput:
/* For IDE Code Blocks or others */
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int l,b;
cout<<"Enter length: ";
cin>>l;
cout<<"Enter width: ";
cin>>b;
cout<<"Area of rectangle is: "<<l*b;
getch();
}
Comments