Showing posts with label programs. Show all posts
Showing posts with label programs. Show all posts

Write a function called Area() Which is used to fined out are of triangel, square, circule. Use the concept of function overloading. Write a main function tha gets value from the user to test three function



#include<iostream.h>
#include<conio.h>

void area(float r)
{

float area;
area=3.65*r;
cout<<endl << "\tArea of Circule:"<<area;
}

void area(float h, float b)
{
float ans;
ans=h*b/2;
cout<<endl<<"\tArea Of Triangle:"<<ans;
}

void area(int no)
{
float ans;
ans=no*no;
cout<<endl<<"\tArea Of Square:"<<ans;
}

void main()
{
clrscr();
area(2.5f);
area(10,2.6f);
area(12);
getch();
}

  • OUTPUT:
    Area Of Circule: 9.125
    Area Of Triangle: 13
    Area Of Square: 144