CSI105 - Lab 02 - AI1901
CSI105 - Lab 02 - AI1901
Duration: 60’
Objective:
Scoring scale: 10
Students will represent the algorithm of the problem in two ways: pseudo-code and
UML
- Using pseudo-code:
Using UML
Result=num1+num2
Q 2. (2 marks): Write an algorithm that will find the number of even numbers as long
as you input until “0” is inputted.
For example:
Input Number of even
5 0
8 1
6 2
2 3
0 3
Q 3. (2 marks): Write an algorithm that will print out the prime numbers between two
integers (n1 < n2) inputted from the keyboard.
For example: user input: 2 9 prime numbers = 3 5 7
Q 4. (4 marks): Write an algorithm that will calculate and print out the electricity cost
(in VND) according to the power consumption (kWh).