Fundamentals of Algorithms CS - 201: Lab Manual 2
Fundamentals of Algorithms CS - 201: Lab Manual 2
Fundamentals of Algorithms
CS – 201
Instructor
Ms. Saher Naqi
Submitted By
Mr. Muhammad. Irfan Arshad
Roll Number: 1387
BS – CS (3rd Semester)
length 10
total 0
for i 1 to length
do
total total + marks[i]
► end for loop
percentage (total/100) x 100
{The Percentage of student in 10 subjects along with his roll# & name}
Problem Statement 2:
50 students of a class appear in the problem 1. Write a
pseudocode for the algorithm to calculate and print the percentage marks obtained
by each student along with his roll number.
length 50
total 0
for i 1 to length
do
percentage[i] (marks[i]/total marks) x 100
► end for loop
{Name, Roll# & Percentage of 50 students along with his roll# & name}
Problem Statement 3:
Write a pseudocode 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.
age 99
for i 1 to length
do
if (age>20)
then
{The name & age of student}
► end if
► end for loop
Problem Statement 4:
Write a pseudocode 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. Assume a sentinel value of 99 for the age field
of the trailer record.
Problem Statement 5:
The first 20 records in a data set are to be read and
printed. Write a pseudocode for the algorithm to do this job. Make sure that the
processing stops after the twentieth record.
Pseudocode Advantages
Pseudocode Disadvantages