Information Technology Loops
Information Technology Loops
IF statements review
1. Write a program to print the message ‘Your tuition is free’ if the student scores over 85
marks in the entrance examination.
2. A store uses the following policy to award discounts. If the customer purchases products
costing more then $500 she is given a discount of 10%, otherwise she is given a discount of
2%. Write a program to compute the discount a customer will receive based on the purchase
she makes.
Do the following programs using for loops as well as using while loops.
1. Using a for loop, write a program which reads a number that represents the number of
students who took an examination. The program should count the number of students who
failed. The pass mark is 60. Output the number passed, number failed and the number of
students who took the exam.
2. Using a for loop, write a program to calculate and print the average score for each student in
a class of 25. Each student was given three tests.
3. Using a while loop, write a program where the user enters the marks of students terminated
by 999. Find and print the average and the highest mark.
3. Consider the following while loop:
begin
a: = 0;
while a < 5 do
begin
a : = a + 3;
writeln(a, ‘is less than 5’);
end;
end.
begin
For a:= 1 to 5 do
writeln (‘Help’);
writeln(‘me’);
end.
9. Write a program that accepts the scores of 20 students using a for loop and adds each
mark to a variable name totalMark. After the loop, out put the total mark.