0% found this document useful (0 votes)
30 views3 pages

Algorithm Flowchart

The document contains two programming problems. The first problem involves calculating the volume of a cube given its height, width, and depth. The second problem involves taking student input and calculating percentage based on marks in 5 subjects.

Uploaded by

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

Algorithm Flowchart

The document contains two programming problems. The first problem involves calculating the volume of a cube given its height, width, and depth. The second problem involves taking student input and calculating percentage based on marks in 5 subjects.

Uploaded by

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

PROBLEM 1:

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:

vol = height* width* depth. (vol = h*w*d)

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:

Msum = msub1 + msub2 + msub3 + msub4 + msub5; Score = (msum/500) × 100


5. Display the name, roll number and percentage score.
6. Stop

Flowchart:

You might also like