Professional Documents
Culture Documents
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:
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:
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
ANSWER: FLOWCHART:
PSEUDOCODE: S
age () T
1. DECLARE age
6. name()
7. ELSE
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:
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