Calculate Area of Triangle, Rectangle and Circle


Program to calculate area of triangle, rectangle and circle in C++





#include<iostream.h>
#include<conio.h>
void main()
{
          clrscr();
          float r,ac,at,ar,b,h,lt,bd;
          cout<<"\nEnter base and height of Triangle :: ";
          cin>>b>>h;
          at=0.5*b*h;
          cout<<"\n\tArea of Triangle is "<<at;

          cout<<"\n\nEnter radius of Circle :: ";
          cin>>r;
          ac=3.14*r*r;
          cout<<"\n\tArea of Circle is "<<ac;

          cout<<"\n\nEnter Length and Breadth of Rectangle :: ";
          cin>>lt>>bd;
          ar=lt*bd;
          cout<<"\n\tArea of Rectangle is "<<ar;
          getch();
}




OUTPUT::

Enter base and height of Triangle :: 5 6

          Area of Triangle is 15

Enter radius of Circle :: 3

          Area of Circle is 28.26

Enter Lenght and Breadth of Rectangle : 2 5

          Area of Rectangle is 10


-----

Firoz Memon

Please view my other blogs:

          C++ Codes 4 Beginners

          Java Tips

          Java 4 Beginners

Previous Post Next Post