Introduction To Programming and Algorithms Dit 0202
Introduction To Programming and Algorithms Dit 0202
c) (i) Write a C program to print your name on the computer screen (2 marks)
(ii) State two characteristics of C programming language (2 marks)
d) (i) Write a C program that accepts three numbers input by the user and computes their
sum and average (4 marks)
1
(ii)Draw a flowchart to represent the program code in d (i) above. (3 marks)
e) Write a C program to print the sum of all odd integer numbers between 1 to 50. Use for
loop. (5 marks)
a) Explain three methods used for testing a program for errors (6 marks)
b) Explain the difference between while and do...while loop statement. give the syntax for
each (5 marks)
c) (i) Give two advantages of using Pseudo code (1 mark)
(ii)Describe three components of an algorithm (3 marks)
2
QUESTION FIVE
a) (i) Write a C program that reads two numbers through the keyboard and determines if
both are even numbers. The numbers are added and the sum output if they are both even
otherwise they are multiplied and the product output. (6 marks)
(ii) Draw a flowchart to represent the program code above. (4 marks)
b) Write a program that computes the volume of a cube. Have the program prompt the user
for each dimension. (5 marks)