# Few Common C++ Programs

#### GO TO INDEX

## Few common C++ Programs

### Find the area of the triangle

## Area Of triangle

#include

const double pi = 3.14159;

int main()

{

float length, width, area;

cout << "Enter The Length Of The Rectangle : ";

cin >> length;

cout << "Enter The Width Of Rectangle: ";

cin >> width;

area = length*width;

cout <<"The area of the rectangle is : "<< area << endl;

return 0;

}

## OUTPUT

Enter The Length Of The Rectangle :2.0

Enter The Width Of Rectangle:5.0

The area of the rectangle is : 10.0

### Find the average of two numbers

## Average

#include

int main()

{

int number1,number2,number3;

double average;

cout<<"Enter three integers and I will display the average"<

average = (number1 + number2 + number3) / 3.0;

cout<<"The average is "<

}

## OUTPUT

Enter three integers and I will display the average3

4

5

The average is4