DIT 0202 Intro To Programming and Algorithms JAN April 2021 MAIN EXAM
DIT 0202 Intro To Programming and Algorithms JAN April 2021 MAIN EXAM
b) Write a C program code that prompt you to enter your name and then displays it on the output
console. [3 marks]
c) Draw flowcharts showing programs flow for the following control statements.
i. while loop [3 marks]
ii. do while loop [3 marks]
iii. for loop. [3 marks]
1
QUESTION TWO: 15 MARKS
b) Write a C program that display all numbers divisible by 5 between 0 and 100. [7 marks]
b) Write a C program code that computes the area of a rectangle, given its dimensions. It should first
prompt the user for the length and width of the rectangle and then displays the area.
[10 marks]
a) Explain the term Algorithm and describe THREE properties of a good algorithm [5 marks]
b) Wananchi Saving Society (wss) pays 5% interest on shares exceeding sh.100, 000 and 3% on shares
that don’t meet this target. However, no interest is paid on deposits in the members’ wss bank
account. Design an algorithm that would;
i. Prompt the user for shares and deposits of a particular member. [5 marks]
ii. Calculate the interest and total savings on the screen for a particular member of the society and
design the above flowchart [5 marks]