INTRO COMPUTER PROGRAMMING
A. Briefly describe the three main types of constants (3 Marks)
B. Re-write the following code sample using a while loop.
int x=0;
int y=5;
do
{
cout<<”statement1”<<end;
y++;
}while(x<y); (3 Marks)
C. Define the term literal (1 Mark)
D. State any two rules followed in the naming of variables in C Programming. (2 Marks)
E. Write a program that prompts the user to enter the radius of a circle.
The program should then compute both the area and circumference of a circle. PI should
be declared as a constant. (8 Marks)
F. Write a C program that will be able to produce the following result shown below. The
program should accept only numbers between 1 and 10. (6 Marks)
Output of the program will appear as:
This program prompts you to enter 5 numbers
Each number should be from 1 to 10
Enter number 1 of 5: 3
Enter number 2 of 5: 6
Enter number 3 of 5: 3
Enter number 4 of 5: 9
Enter number 5 of 5: 2
Value 1 is 3
Value 2 is 6
Value 3 is 3
Value 4 is 9
Value 5 is 2