You are on page 1of 8

ACTIVITY

0 9. 0 7. 2 0 2 1
Write the pseudocode, algorithm and draw the
flowchart.

1. Write an algorithm and draw the flowchart that reads three numbers and prints the value of
the largest number.

Pseudocode
DECLARE isLargestNum

SET isLargestNum TO GetLargestNum()

IF isLargestNum THEN

OUTPUT isLargestNum

ELSE

OUTPUT “All or two(2) numbers are equal”

END

Algorithm

STEP 1: Start.

STEP 2: Initialize num1, num2, num3, LargestNum

STEP 3: Set the following conditions to find the Largest Number, if found go to STEP 4.

1. (num1 > num2 && num1 > num3) if the statement is TRUE then num1 is
the LargestNum.
2. V(num2 > num1 && num2 > num3) if the statement is TRUE then num2
is the LargestNum.
3. (num3 > num1 && num3 > num1) if the statement is TRUE then num3 is
the LargestNum.

STEP 4: Print the LargestNum

STEP 5: Stop.

Flowchart
2. A student appears in an examination that consists of total 10 subjects, each subject having
maximum marks of 100. The roll number for the student, his name, and the marks obtained by
him in various subjects is supplied as input data. Such a collection of related data items that is
treated as a unit is known as a record. Draw a flow chart for the algorithm to calculate the
percentage marks obtained by the student in this examination and then to print it along with his
roll number and name.

Pseudocode

DECLARE isPercentageMark
SET isPercentageMark TO getPercentageMark()
CALL StudentRecord()

Algorithm

STEP 1: Start.

STEP 2: Initialize variables: StudentNamet, RollNo, MarksperSub, PercentageMarks

STEP 3: Set the StudName, RollNo, and MarksObtained as StudentRecord.

STEP 4: PercentageMark = MarksperSub x .100

STEP 5: Print StudentRecord


STEP 6: Stop

Flowchart

3. Draw a
flow
chart of
the
logical
steps
needed
to
produce
a
printed
listing of
all
students over the age of 20 in a class. The input records contain the name and age of the
students. Assume an initial value of 99 for the age field.
Pseudocode
DECLARE Student
SET as Student TO getAgeStudent()
IF Student > 20 THEN
ListStudent = +1
ELSE
“Underaged”
END
IF ListStudent = < 99 THEN
CALL InputRecords()
ELSE
“The initial value for age field reach its capacity”

Algorithm

STEP 1: Start.

STEP 2: Initialize variables: StudentAge, StudentName

STEP 3: Set StudentName and StudentAge to InputRecord

STEP 4: Set the condition.

If StudentAge > 20

Then

ListStudent = +1

Else

“Underaged”
End

STEP 5: If ListStudent <= 99

Then

Print InputRecords of the Student


STEP 6: Stop

Flowchart
4. Draw a flowchart of the logical steps needed to print the name and age of the oldest and the
youngest student in a class. The input records contain the name and age of the students.

Pseudocode
DECLARE OldestStudent, YoungestStudent
SET OldestStudent TO getAgeStudent()
SET YoungestStudent TO getAgeStudent()
IF OldestStudent THEN
CALL InputRecords()
ELSE
END
IF YoungestStudent THEN
CALL InputRecords()
ELSE
END

Algorithm

STEP 1: Start.

STEP 2: Initialize variables: StudentAge, StudentName, YoungestStudent, and


OldestStudent

STEP 3: Set StudentName and StudentAge to InputRecords

STEP 4: Set the conditions.

If StudentAge <= YoungestStudent

Then

Print InputRecords

Else If StudentAge >= Oldest

Then

Print InputRecords
Else

END

STEP 5: Stop

Flowchart

You might also like