0% found this document useful (0 votes)
7 views4 pages

Prac 1

The document outlines a practical activity for students to calculate the volumes of a cube, cylinder, and sphere using C programming. It includes sample inputs, processes, outputs, algorithms, flowcharts, and code snippets for each shape. The objective is for students to apply arithmetic operators and data handling in C to solve volume-related problems.

Uploaded by

dua186641
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

Prac 1

The document outlines a practical activity for students to calculate the volumes of a cube, cylinder, and sphere using C programming. It includes sample inputs, processes, outputs, algorithms, flowcharts, and code snippets for each shape. The objective is for students to apply arithmetic operators and data handling in C to solve volume-related problems.

Uploaded by

dua186641
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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.

Volume of Cube
Sample Input Process Sample Output
Length = 4 Volume = length * length * length Volume of Cube = 64

Volume of Cylinder
Sample Input Process Sample Output
Height = 5
Volume = π * radius * radius * height Volume of Cylinder = 1005.12
Radius = 8

Volume of Sphere
Sample Input Process Sample Output
4
Radius = 6.5 Volume = 𝜋𝑟 3 Volume of Cube = 1150.1295
3

Fill the sections on the pages below as evidence of the practical activity.
Computer Science Practical: X

Volume of Cube
Algorithm Flowchart
Step1: Start
Let the length of one side of cube is 4
Step2: Calculate the volume
Volume=𝑙3
Step3: Output Volume
Step4: Stop

Code Output

#include <stdio.h>
int main ()
{
float length, volume;
printf ("enter the lenght:");
scanf ("%f", & lenght);
volume=(lenght*lenght*lenght);
printf ("volume of cube is: %.2f", volume);
return 0;
}

2
Computer Science Practical: X

Volume of Cylinder
Algorithm Flowchart
Step1: Start
Let radius is 8 and height is 5 and π is 3.14
Step2: Calculate the volume
Volume=πr2ℎ
Step3: Output Volume
Step4: Stop

Code Output

#include <stdio.h>
#include <math.h>
#define PI 3.14159
int main ()
{
float radius, Volume, Height;
printf ("enter the Height:");
scanf ("%f", & Height);

printf ("enter the radius:");


scanf ("%f", & radius);

volume = (PI * pow (radius, 2) * Height);


printf ("Volume of Cylinder is: %.2f", volume);
return 0;
}

3
Computer Science Practical: X

Volume of Sphere
Algorithm Flowchart
Step1: Start
Let radius is 6.5 and π is 3.14
Step2: Calculate the volume
4
Volume= 𝜋𝑟 3
3
Step3: Output Volume
Step4: Stop

Code Output
#include <stdio.h>
#include <math.h>
#define PI 3.14159
int main ()
{
float radius, volume;

printf ("enter the radius:");


scanf ("%f", &radius);
volume= (4.0/3*PI*pow (radius, 3));
printf ("Volume of Cube is: %f", volume);
return 0;
}

You might also like