You are on page 1of 1

UNIVERSITY OF TECHNOLOGY, JAMAICA

SCHOOL OF COMPUTING & INFORMATION TECHNOLOGY (SCIT)

Programming I Worksheet - Week 2 (Algorithm Development)

Tutorials – Develop pseudocode and flowcharts for the following problems.


Practical – Implement the psuedocode developed in the tutorial into C programs

1. Write statements to do the following:


a. Declare an integer variable named sum
b. Declare a real number variable named price
c. Declare a character variable named option
d. Initialize a real number variable, product, to 1

1. Draw a line to match the term with the appropriate shape

a. Input i.

b. Processing ii.

c. Decision iii.

d. Terminal iv.

e. Connector v.

2. Design a program that outputs the product of 123 and 56.


3. Design a program that performs the same task as the question above but outputs a meaningful
message before the product.
4. You require an algorithm that will receive an integer from the screen, add 5 to it, double it,
subtract 7 from it and display the final number to the screen.
5. Joseph’s Department store needs a program to prepare a bill for each customer. For each
purchase, there will be four input values: customer name, item, quantity purchased and price.
The output will be the customer’s monthly bill after a 10 percent discount is taken before
taxes, and a 5 percent sales tax is added.
6. A program is required to read in the length and width of a rectangular house block, and the
length and width of the rectangular house which has been built on the block. The algorithm
should then compute and display the time required to cut the grass around the house, at the
rate of two square metres per minute.
7. Write a program that inputs one five-digit number, separates the number into its individual
digits and display the number in reverse. [Hint: use a combination of integer division and the
remainder operation]. For example if the user types in 34567, the program should print:
76543.
8. Write a program that reads four integers from the keyboard, calculates their average, and then
prints the numbers with their average and the deviation from the average. See a sample run
below:

Enter the first number: 23


Enter the second number: 12
Enter the third number: 45
Enter the fourth number: 23

Average is 25.75

1st number: 23 Deviation: -2.75


2nd number: 12 Deviation: -13.75
3rd number: 45 Deviation: 19.25
4th number: 23 Deviation: -2.75

You might also like