C Program to Calculate Area of Geometric Shapes

 C Program to Calculate Area of Geometric Shapes




/*********************************************************************
C Program to calculate area of geometric shapes
area of circle
area of triangle
area of rectangle
area of square
area of cube
********************************************************************/
#include<stdio.h>
#include<conio.h>
void main()
{
float r,height,base,l,b,side,area;

clrscr();
printf("Enter radius\n");
scanf("%f",&r);
printf("Enter base and height\n");
scanf("%f%f",&base,&height);
printf("Enter length and breadth\n");
scanf("%f%f",&l,&b);
printf("Enter side\n");
scanf("%f",&side);
area=3.14*r*r;
printf("The area of circle is:\t%f\n",area);
area=0.5*height*base;
printf("The area of
triangle is:\t%f\n",area);
area=l*b;
printf("The area of rectangle is:\t%f\n",area);
area=side*side;
printf("The area of square is:\t%f\n",area);
area=6*side*side;
printf("The area of cube is:\t%f\n",area);
printf("End of program");
}


Enter radius

1

Enter base and height

1 2

Enter length and breadth

1 2

Enter side

1

The area of circle is: 3.140000

The area of triangle is: 1.000000

The area of rectangle is: 2.000000

The area of square is: 1.000000

The area of cube is: 6.000000

End of program

टिप्पणी पोस्ट करा

0 टिप्पण्या