Professional Documents
Culture Documents
No
1.
Area
Rectangle
Formula
Area = Length x Width
2.
Square
3.
Triangle
4.
Circle
Area = x Radius
Formula
Volume = Length x Width x Height
2.
Volume
Rectangular
Solid
Cube
3.
Cones
4.
Sphere
5.
Cylinder
Volume = Lenght
Shape
Black Book
Rectangle
L
Rec_Area = L
W
2.
C-Programing Code
B.B
Area
Rec_Area
Square
B.B
Sq_Area = L L
3.
Sq_Area
Triangle
B
Tri_Area = B
H
4.
AREA
B.B
AREA
Tri_Area
Circle
B.B
Cir_Area = r
AREA
Cir_Area
Shape
Black Book
Rectangle Solid
L
Rec_Area = L
W
2.
C-Programing Code
B.B
Vol
Rec_Vol
Cube
B.B
Cb_vol = L L
L
3.
Vol
Cb_Vol
Cone
B.B
r
Con_Vol =
H
Vol
Con_Vol
1/3 r H
4.
Sphere
B.B
Sp_Vol = 4/3
r
Vol
Sp_Vol
Return Vol ;
}
5.
Cylinder
Cy_Vol = r
H
r
H
B.B
Vol
Cy_Vol
Select Area or
Volume Calculator
Shape Selection
Area
Volume
Rectangle,
Square, Triangle,
Circle
Rectangle Solid,
Cube Cone,
Sphere, Cylinder
Read data:
,r , H, L, B
Calculate Area
or volume
Print Area or
Print volume
C- Programming Codes
Terminate Program
#include <stdio.h>
int main ()
{
int choice11;
int choice22;
int terminate = 1;
while( terminate == 1)
{
printf("Please enter\n 1 for volume\n 2 for area\n User choice : ");
scanf("%d", & choice11);
if( choice11 == 1)
{
printf("\n\nPlease select the shape of volume: Enter: \n1 Rectangular Solid; \n2 - Cube; \n3 - Cone; \n4 - Sphere; \n5- Cylinder; :
\n\n");
scanf("%d",&choice22);
if (choice22== 4)
{
printf("\nShape selected: Sphere");
scanf("%f",&w);
float h;
scanf("%f", &h);
float vol = (1.0*3.14*r*r*h)/ 3.0;
printf("\nThe Volume of Cone: %f\n\n", vol);
}
else if(choice22== 5)
{
printf("\nShape selected: Cylinder");
printf("\nEnter the Radius:");
float r;
scanf("%f",&r);
printf("\nEnter the Height:");
float h;
scanf("%f",&h);
float vol = 3.142*r*r*h;
printf("\nthe volume of Cylinder: %f\n\n", vol);
}
}
if (choice11 == 2)
{
printf("\n\nPlease select the shape of Area: Enter \n6 Rectangle; \n7 - Square ; \n8 - Triangle; \n9 - Circle : \n\n");
scanf("%d",&choice22);
if (choice22== 9)
{
printf("\nShape selected: Circle ");
printf("\nEnter the radius:");
float r;
scanf("%f",&r);
float Area = 3.14*r*r;
printf("\nThe Area of Circle: %f\n\n", Area);
}
else if(choice22== 6)
{
printf("\nShape selected: Rectangle ");
printf("\nEnter the Length:");
float l;
scanf("%f",&l);
printf("\nEnter the Width:");
float w;
scanf("%f",&w);
float Area = l*w;
printf("\nThe Area of Rectangle: %f\n\n", Area);
}
else if(choice22== 7)
{
printf("\nShape selected: Square");
printf("\nEnter the side Length: ");
9
float l;
scanf("%f",&l);
float Area = l*l;
printf("\nThe Area of Square: %f\n\n", Area);
}
else if(choice22== 8)
{
printf("\nShape selected: Triangle");
printf("\nEnter the Base: ");
float b;
scanf("%f", &b);
printf("\nEnter the Height: ");
float h;
scanf("%f", &h);
float Area = (1*b*h)/2;
printf("\nThe Area of Triangle: %f\n\n", Area);
}
}
Square Area
11
Triangle
Circle
Area = x radius
12
13
Cube
Vol = Length
Cones
Sphere
14
Cylinder
15
16