Name: Bilal Ahmed Khan Grade: XA
SLO No 9.2.2
SLOs Mapped 8.3.2, 9.1.1,9.1.2,9.1.3,9.1.5,9.2.2,9.2.3,9.2.4
Practical Activity To find the volume of cube, cylinder or sphere
Equipment Computer
Software Dev C++
Practical No 1
Topic 9: Fundamental of input and output data handling in C
Objective:
Students will be able to
● use the arithmetic operators and input output data handling in C language to solve the given
arithmetic problem.
Note: You can use any compiler for program execution.
Fill the sections below as evidence of the practical activity.
Algorithm Flowchart
Cube Cube Cylinder Sphere
Step 1: start
Step 2: input l
Step 3: v=l*l*l
Step 4: print v
Step 5: stop
Cylinder
Step 1: start
Step 2: input h, r
Step 3: v=3.142*r*r*h
Step 4: print v
Step 5: stop
Sphere
1
Computer Science Practical: X
Name: Bilal Ahmed Khan Grade: XA
Step 1: start
Step 2: input r start start start
Step 3: v=(4/3)*3.142*r*r*r
Step 4: print v
Step 5: stop
Input l Input h, r Input r
V=3.142*r*r*h V=(4/3)*3.1428r*r*r
V=l*l*l
print v print v
print v
Stop Stop
Stop
Program Coding
Cube Cylinder Sphere
#include<stdio.h> #include<stdio.h> #include<stdio.h>
int main() int main() int main()
{ { {
float l, v; float h, r, v; float r, v;
printf("Enter length= "); printf("enter height= "); printf("enter radius= ");
scanf("%f", &l); scanf("%f", &h); scanf("%f", &r);
v=l*l*l; printf("enter radius= "); v=(4/3)*3.142*r*r*r;
printf("volume= %f", v); scanf("%f", &r); printf("volume= %f", v);
return 0; v=3.142*r*r*h; return 0;
} printf("volume= %f", v); }
return 0;
2
Computer Science Practical: X
Name: Bilal Ahmed Khan Grade: XA
}
Program Output
Cube
Cylinder
Sphere