C++ Program To Find The Area Of Triangle And Circle 


#include<iostream>
using namespace std;
#include<iomanip>
#define PI 3.14  // defining the value of PIE.

int circle(float radius)                                  // Passing Arguments to function
{
return(PI*radius*radius);
}
int triangle(float length, float height)             //Passing Arguments to function
{
return((length*height)/2);
}
int main()
{
float radius, length, height,area1,area2;
cout<<"Enter length and height of the triangle:\n";                //Asking for input
cin>>length>>height;                                                  // Reading input
cout<<"Enter radius of circle:\n";                                          //Asking for input
cin>>radius;                                                                          // Reading input
triangle(length,height);                                                                    // Calling Function
cout<<"The area of triangle is "<<(length*height)/2<<endl;    //Displaying OUTPUT
circle(radius);                                                                                    // Calling Function
cout<<"The area of circle is "<<PI*radius*radius<<endl; //Displaying OUTPUT
}


OUTPUT


Enter length and height of the triangle:
5
4
Enter radius of circle:
6
The area of triangle is 10
The area of circle is 113.04
Share To:

Arogya Thapa Magar

Post A Comment:

0 comments so far,add yours