You are on page 1of 5

EXPERIMENT NUMBER- 1.

STUDENT’S NAME- NAVJYOT SINGH DHALIWAL


STUDENT’S UID- 20BCS3184
CLASS AND GROUP- BCS29/ GRP.A
SEMESTER- 1
DATE- 19/09/2020

TOPIC OF EXPERIMENT-

A cube having a side of 6 cm is painted red on all the faces and then cut into smaller
cubes of 1 cm each. Write a program to find the total number of smaller cubes so
obtained.

AIM OF THE

EXPERIMENT-

Learn how to perform input output operations using C Prerequisites- Basic


Mathematics Knowledge

FLOWCHART/ ALGORITHM-

1. START

2. #include <stdio.h>

3. Design the side of the painted cube

4. Design for smaller cubes

5. Assign values

6. Print C

7. STOP

SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112


PROGRAM CODE-

#include <stdio.h>

int main()

   int side_of_cube,cut_into,new_side,number_of_cubes;

   printf("side of painted cube: ");

   scanf("%d",&side_of_cube);

   

   printf("side of cube to cut into: ");

   scanf("%d",&cut_into);

   

   new_side=side_of_cube/cut_into;

   number_of_cubes=new_side*new_side*new_side;

   

   printf("number of smaller cubes generated= ");

   printf("%d",number_of_cubes);

   return 0;

 }

SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112


ERRORS ENCOUNTERED DURING PROGRAM’S EXECUTION
(Kindly jot down the compile time errors encountered)-

1. Syntax errors: errors due to the fact that the syntax of the language is not
respected (6 times).
2. Semantic errors: errors due to an improper use of program statements (1time).
3. Logical errors: errors due to the fact that the specification is not respected (2
times).
4. Compile time errors: syntax errors and static semantic errors indicated by the
compiler (7 times).

PROGRAMS’ EXPLANATION (in brief)-


in this practical we are given a cube whose side is of 3 cm each and is in three
small cubes giving us three cubes of 1cm each.

Now we have to find the total number of small


cubes present in it.
For that we know that: -
Side of the cube= 6cm
Side of cube cut into small cubes of length= 1cm

After running the program, we get to know that: -


Total number of small cubes= 216

SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112


OUTPUT-

LEARNING OUTCOMES-
 Learned how to perform input and output operations.
 Learned how to get mathematical solutions.
 Learned to use integer functions.

SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112


EVALUATION COLUMN (To be filled by concerned faculty only)

Sr. No. Parameters Maximum Marks


Marks Obtained
1. Student’s performance while executing the 12
program in Computer Lab
2. Completion of worksheet with learning 10
outcomes and program’s output along with
cleanliness and discipline.
3. Clarification of theoretical concepts 8

4. Total Marks 30

5. Teacher’s Signature (with date)

SUBJECT NAME-Problem Solving with Programming Lab SUBJECT CODE-20CSP112

You might also like