Algorithm Flowchart
Algorithm Flowchart
Write a Program to calculate and display the volume of a CUBE having its height (h=10cm), width
(w=12cm) and depth (8cm).
Problem Analysis:
The problem is to calculate the volume of a CUBE having its inputs parameters identified as:Height
(integer type), width (integer type) and depth (integer type). The output of the program is to display the
volume; hence the output parameter is identified as vol (integer type). During the processing or
calculation phase, we don’t need any extra parameters (variables) for this problem.
The volume of the cube is the multiplication of its height, width and depth, hence the mathematical
formula to calculate volume is:
Algorithm:
1. Start
2. Define variables: h(int), w(int), d(int), vol(int)
3. Assign value to variables: h = 10, w=12, d=8
4. Calculate the volume as: vol = h*w*d
5. Display the volume (vol)
6. Stop
Flowchart:
Problem 2:
Write a program to take input of name, rollno and marks obtained by a student in 5 subjects each have its
100 full marks and display the name, rollno with percentage score secured.
Problem Analysis:
Based on the problem, it is required to get the input of name, roll number and marks in 5 subjects of a
student. The program should display the name; roll number and percentage of marks secured by that
student as output. The input variables shall be: name, rollno, msub1, msub2, msub3, msub4, msub5. We
need to calculate percentage of marks obtained. So the variable ‘score’ holds the percentage to be
displayed.
Percentage of marks obtained = (total marks on 5 subjects/ total full marks) × 100
Hence, msum = msub1 + msub2 + msub3 + msub4 + msub5
Score = (msum/500) × 100
Algorithm:
1. Start
2. Define variables: name, rollno, msub1, msub2, msub3, msub4, msub5, msum, score
3. Take input from keyboard for all the input variables
4. Calculate the sum of marks of 5 subjects and also calculate the percentage score as:
Flowchart: