Description: This program in C finds out the Area and Volume of Square, Rectangle, Circle and Triangle.
#include<conio.h>
#include<stdio.h>
main()
{
int a,b,c,d,e,r,s,t,u,v,w,x,y,z;
clrscr();
printf("Among them U can Calculate all's AREA and VOLUME\n\n\n");
printf("\t\t 1.Square\n\n");
printf("\t\t 2.Rectangle\n\n");
printf("\t\t 3.Circle\n\n");
printf("\t\t 4.Triangle\n\n");
printf("Please enter the numbers 1/2/3/4 to choose an item\n\n");
scanf("%d",x);
printf("~~~~~~~~~~~~~~~~~~SQUARE~~~~~~~~~~~~~~~~~~\n");
printf("\nEnter the Length of Square = ");
scanf("%d",&a);
printf("\t\t\t\t\t\t\t ------");
b=a*a;
z=a*a*a;
printf("\nThe Total area of the Square = l*l\t\t| |");
printf("\n\t\t\t\t = %dcm2\t\t| |\n",b);
printf("The Total volume of Square = l*l*l\t\t| |");
printf("\n\t\t\t\t = %dcm3\t\t ------\n",z);
printf("\n~~~~~~~~~~~~~~~~RECTANGLE~~~~~~~~~~~~~~~~\n");
printf("\nEnter the Length of Rectangle = ");
scanf("%d",&c);
printf("Enter the Breadth of Rectangle = ");
scanf("%d",&d);
printf("Enter the Height of Rectangle = ");
scanf("%d",&e);
y=d*c;
w=c*d*e;
printf("\nThe Total area of the Rectangle = l*b");
printf("\n\t\t\t\t = %dcm2",y);
printf("\nThe Total Volume of the Rectangle = l*b*h");
printf("\n\t\t\t\t = %dcm3",w);
printf("\n~~~~~~~~~~~~~~~~~CIRCLE~~~~~~~~~~~~~~~~~\n");
printf("\nEnter the Radius of the Circle = ");
scanf("%d",&r);
v=(22/7)*r*r;
printf("\nThe area of the Circle =%dcm2\n",v);
printf("\n~~~~~~~~~~~~~~~~~TRIANGLE~~~~~~~~~~~~~~~~~\n");
printf("\nEnter the length of Base of Triangle = ");
scanf("%d",&u);
printf("Enter the Height of Triangle = ");
scanf("%d",&t);
s=0.5*u*t;
printf("\nThe Area of Triangle =%dcm2",s);
getch();
}
The post C Program – Code – Area and Volume of Square, Rectangle, Circle and Triangle appeared first on The Computer Students.