CCS 1203 Introduction To Computer Programming CAT
CCS 1203 Introduction To Computer Programming CAT
SCHOOL OF ENGINEERING
DEPARTMENT OF CIVIL ENGINEERING
d) A humanoid robot requires an upgrade that will enable it to cross the road guided by
the traffic lights in much the same way humans do. Write a program in C which
would demonstrate this function. Assume input and output is from the keyboard and
to the screen respectively. The keyboard only allows input in lowercase. [6 marks]
a) Indicate the most appropriate loop to use under each of the conditions stated below:
[2 marks]
i. When the number of iterations is not known
ii. When the number of iterations is known
b) Write a program that uses a while loop to print all odd numbers between 10 and 100
[4 marks]
c) Using nested for loops, write a C program that generates and displays the
multiplication table in the pattern shown below; [9 marks]
* 1 2 3 4
1 1 2 3 4
2 2 4 6 8
3 3 6 9 12
4 4 8 12 16