Computer_Programming I
Computer_Programming I
a) Explain the two main preprocessor directives used in C language. Give examples of how
each is used. (6 Marks)
b) Using a diagram briefly highlight key features of the C Compilation model.(4 Marks)
i. \n
ii. \b
iii. \r
iv. \'
v. \"
vi. \\
Write a program that accepts input and produces the result of ‘x’. x>0 being real roots;
x=0 being repeated roots and x<0 being imaginary roots. ( 8 Marks)
QUESTION TWO [20 MARKS]
i. Variable
ii. Data type
iii. Constant
c) Write a Program to Find Value of sin(x) using Expansion Series Given Below:
sin(x) = x - x3/3! + x5/5! - x7/7!........ (8 Marks)
b) Write a Program to Print the Numbers, Which are Divisible by 3 and 5 from
First 100 Natural Numbers (7 Marks)
Where N! = 1 ´ 2 ´ 3 ´ …… N . (8 Marks)
Where N! = 1 ´ 2 ´ 3 ´ …… N . (6 Marks)
QUESTION FIVE [20 MARKS]
b) Write a Program that Reads a text letter-by-letter, store it into an array and then print it
letter-by-letter. (8 Marks)
#include <stdio.h>
#include <stdlib.h>
void main()
int x, *p;
*p = 0; /* set x to zero */
exit(EXIT_SUCCESS);