Google

Thursday, January 28, 2010

CSC202 : Exercise 4

1. A salesman gets basic pay $200 per month + commission.
The commission is based on the following formula.
For the first $1000 sales made, the commission is 10% sales.
For the remaining sales above $1000, the commission is 20% of the sales.

For example, if a salesman sale for the month is $3000, then his salary is:

200 + (10% x 1000) + (20% x 2000)
= 200 + 100 + 400
= 700

SOLUTION:



2. Write a program that can find all prime numbers from 2 to 1000.
Example of the first eight prime numbers:

2,3,5,7,11,13,17,23...


SOLUTION: