#include <stdio.h>
int main()
{
int choice;
float l,b,r,pr,ar;
printf("\n\t\t\t\t\t\t\tMENU OF AREA \n\n\n1. Rectangle \n2. Square \n3. Circle \n4. Right angled triangle \n5. EXIT");
printf("\n\n Enter your choice:");
scanf("%d",&choice);
printf(" \n You have choosen : %d",choice);
switch(choice)
{
case 1: printf("\n\n\n\n Enter length & breadth of Rectangle:");
scanf("%f%f",&l,&b);
printf("\n You have Entered length & breadth of Rectangle is %f",l,b);
ar=l*b;
pr=2*(l+b);
printf("\n Area of Rectangle: %f & Peremeter of Rectangle: %f",ar,pr);
break;
case 2: printf("\n Enter side of Square:");
scanf("%f",&l);
printf("\n You have Entered Side of square is %f",l);
ar=l*l;
pr=4*l;
printf("\n Area of Square: %f & Peremeter = %f",ar,pr);
break;
case 3: printf("\n Enter radius of circle:");
scanf("%f",&r);
printf("\n You have Entered radius of circle is %f",r);
ar=3.14*r*r;
pr=2*3.14*r;
printf("\n Area of circle:%f & Peremeter :%f",ar,pr);
break;
case 4: printf("\n Enter base and height of right angled triangle:");
scanf("%f%f",&l,&b);
printf("\n You have Entered base & height of Right angled triangle is %f",l,b);
ar=1/2.0*b*l;
printf("\n Area of right angled triangle: %f",ar);
break;
case 5: printf("\n WRONG CHOICE");
break;
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: