//this code is designed by codenation
//5:52 11/20/2020
#include<stdio.h>
#include<math.h>
void square();
void circle();
void rectangle();
void square()
{
int side,area;
printf("\nenter the length of side :\n");
scanf("%d",&side);
area=side*side;
printf("the area of square is : %d",area);
}
void circle()
{
const int pi=3.142;
float rad;
float area;
printf("\nenter the radius of circle :\n");
scanf("%f",&rad);
area=rad*rad*pi;
printf("the area of circle is : %f",area);
}
void rectangle()
{
int l,b,area;
printf("\nenter the length of rectangle :\n");
scanf("%d",&l);
printf("enter the breadth of rectangle :\n");
scanf("%d",&b);
area=l*b;
printf("area of rectangle is : %d",area);
}
int main()
{
int ch;
printf("welcome to area calculator");
while(1)
{
printf("\n\nyou want area of which shape :\n");
printf("1.circle\n2.square\n3.rectangle\n4.exit\n");
scanf("%d",&ch);
switch(ch)
{
case 1:
circle();
break;
case 2:
square();
break;
case 3:
rectangle();
break;
case 4:
return 0;
}
}
}
//this code is developed by codenation
Comments
Post a Comment