You are on page 1of 5

PRELIM ACTIVITY : 09/07/2021

Write the pseudocode, algorithm and draw the flowchart

Lapiña, Ma. Ann Jelyn P.


BSIT 2nd yr College

Prelim Activity

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

ANSWER:

PSEUDOCODE:
L_number()
1. DECLARE is L_number
2. SET is L_number TO CHECK If L_number < 70()
3. IF NOT L_number THEN
4. CALL L_number ()
5. END
6. CALL Read L_number

ALGORITHM:

STEP1: Input 10,20,30


STEP2: L_number (10+20+30)
STEP 3: If L_number > 70 Then Print “L_number”
Else read the “L_number”
End
FLOWCHART:

L_number

Input
10,20,30

L_number =
10+20+30

If
L_num
ber <
R 40
e

End
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.

ANSWER:

PSEUDOCODE:

1 Rollnoandname( )
2 Declare String RepeatAgain
3 Do
4 //Calculate and display percentage of each students percentages
5 Call
Show (obtainmarks/totalmarks)*100 ( )
6 Display "a percentages along with rollnoandname(Enter y for yes.)"
7 Input RepeatAgain
8 While RepeatAgain== "y" OR RepeatAgain== "10times"
9 End Rollnoandage

ALGORITHM:

STEP 1: Enter Rollnoandname


STEP 2: Calculate and display percentage of each students percentages
STEP 3: (obtainmarks/totalmarks)*100
STEP 4 : a percentages along with rollnoandname
STEP 5: RepeatAgain== "10times"

FLOWCHART: START

Enter
Rollnoandname

Calculate and
display percentage of
each students
percentages

(obtainmarks/
totalmarks)*100
L
Display a percentages along
with rollnoandname

En
d
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.

ANSWER: FLOWCHART:

PSEUDOCODE: S
age () T
1. DECLARE age

2. SET age TO 20()

3 IF age > "20" OR “name” THEN


Enter
4. age ()
name
5. ELSE IF age > "20" THEN

6. name()

7. ELSE

8. CALL name and age ()


I
9.END
f
ALGORITHM:
Di a
STEP1: Enter age
s
STEP2: age > 20
pl End
STEP 3: If age > 20 Then Print “age”

Else “name and age”

End

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.

ANSWER:

PSEUDOCODE

nameandage()
1. DECLARE isyoungest,oldest
2. SET nameandage TO youngest()
3. SET nameandage TO oldest()
4. IF nameandage THEN
5. IF nameandage THEN
6. youngest()
7. ELSE
8. oldest()
9. END
10. END

ALGORITHM:

STEP1: Enter name and age


STEP2: name and age (youngest and oldest)
STEP 3: If name and age Then Print “youngest”
Else “oldest”
End

FLOWCHART:
S
T
Enter
name
and

Check which
Y Student is the O
o Youngest and l
oldest?

Dis Display
pla Oldest
y age
and name

You might also like