#include<stdio.h>//header file
#include<conio.h>//header file
void main() //starting of the main() function
{
int c;
float r,l,b,a,d,g,a1,a2;//declaration of the variables
clrscr();
printf("program that calculates area of curves by menu driven program");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter 1 for area of circle"); //taking input from the user
printf("\n\nenter 2 for area of rectangle");
printf("\n\nenter 3 for area of ellipse");
printf("\n\nenter your choice");
scanf("%d",&c);
switch(c)
{
case 1:
printf("\n\nenter the radius of the circle");
scanf("%f",&r);
a=3.1428*r*r;
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe area of the circle is :%f",a);//printing output
break;
case 2:
printf("\n\nenter the length and breadth of the rectangle");
scanf("%f%f",&l,&b);
a1=l*b;
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe area of the rectangle is :%f",a1);//printing output
break;
case 3:
printf("\n\nenter the length of the major and minor axis");
scanf("%f%f",&g,&d);
a2=(3.1428*g*d)/4;
printf("\n\n\n\t\t------------OUTPUT------------");//printing output
printf("\n\nthe area of the ellipse is:%f",a2);
break;
default:
printf("\n\n\n\t\t------------OUTPUT------------");//printing output
printf("\n\nyou have entered the wrong choice");
}
getch();
}