#include
#define PI 3.147
int Circle(int r)
{
printf("Area of Circle = %f\n",PI * (r*r));
printf("Perimeter of Circle = %f\n",2 *PI * r);
}
/**********************************************************************************************/
int Square(int side)
{
printf("Area of Square = %d\n",side * side);
printf("Perimeter of Square = %d\n",4 * side);
}
/**********************************************************************************************/
int Triangle(int a,int b,int c)
{
float s = (a + b + c) / 2;
float area = (float) ( sqrt (s * (s-a) * (s-b) * (s-c)));
printf("Area of Triangle = %.1f\n",area);
printf("Perimeter of Triangle = %.1f\n",s);
}
/**********************************************************************************************/
int Rectangle(int length,int width)
{
printf("Area of Rectangle = %d\n",length * width);
printf("Perimeter of Rectangle = %d\n",2 * (length + width) );
}
/**********************************************************************************************/
int Ellipse(int x,int y)
{
printf("Area of Ellipse = %f\n",PI * x * y);
printf("Perimeter of Ellipse = %f\n",(float)(2 * PI * sqrt(x*x + y*y)));
}
/**********************************************************************************************/
main() // Beginning of Main Function
{
int choice = 0,a = 0,b = 0,c = 0;
do
{
printf("For Circle Press <>\nFor Square Press <>\nFor Triangle Press <>\nFor Rectangle Press <>\nFor Ellipse Press <>\n---------------------------\n");
printf("Enter Your Choice --> ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("Please Enter Radius of Circle\n");
scanf("%d",&a);
Circle(a);
break;
case 2:
printf("Please Enter Side of Square\n");
scanf("%d",&a);
Square(a);
break;
case 3:
printf("Please Enter Sides of Triangle (like 1 2 3)\n");
scanf("%d%d%d",&a,&b,&c);
Triangle(a,b,c);
break;
case 4:
printf("Please Enter Length & Breadth of Rectangle\n");
scanf("%d%d",&a,&b);
Rectangle(a,b);
break;
case 5:
printf("Please Enter Two Axes of Ellipse (like 2 3)\n");
scanf("%d%d",&a,&b);
Ellipse(a,b);
break;
default:
printf("Please Enter the Valid Choice\n");
}// switch
printf("To Continue Press 1 Else Other to Exit\n");
scanf("%d",&choice);
} while(choice == 1);
printf("Bye......\n\n");
}// End of Main