Friday, 18 December 2015

LBEPS Notes 1


1..LBEPS_01_Let's Practice_Solution




1.          Identify the input, processing, and output phases in the following tasks:
l   Calculating the sum of two numbers using a calculator.

Solution:
w   Input:  
First number
‘+’ operator
Second number
‘=’ operator
w   Process:
Calculation of the sum
w   Output:
Sum of the two numbers

l   Obtaining the juice of a fruit using a juicer machine.

Solution:
w   Input:
Fruit
w   Process:
Extraction of the juice
w   Output:
The juice of the fruit

l   Creating knitwear.

Solution:
w   Input:
Knitting wool
w   Process:
Knitting the sweater
w   Output:
Sweater or knitwear

l   Baking bread.

Solution:
w   Input:
Flour, water, flat base, and rolling pin

w   Process:
Kneading the dough using flour and water
Rolling the bread
Baking the bread
w   Output:
Bread

l   Washing clothes in a washing machine.

Solution:
w   Input:
Dirty clothes
Detergent
Water
w   Process:
Washing the clothes
w   Output:
Clean clothes
1.2 Let’s Practice

1.          Write an algorithm to find out whether a number entered by a user is divisible by 5.

Solution:

Step 1: Start the algorithm.
Step 2: Accept a number.
Step 3: Divide the number by 5.
Step 4: If the remainder is 0, the number is divisible by 5.
Step 5: If the remainder is not 0, the number is not divisible by 5.
Step 6: End the algorithm.

2.         Write an algorithm to display the first 10 multiples of 9.

Solution:
Step 1: Start the algorithm.
Step 2: Display 9*1.
Step 3: Display 9*2.
Step 4: Display 9*3.
Step 5: Display 9*4.
Step 6: Display 9*5.
Step 7: Display 9*6.
Step 8: Display 9*7.
Step 9: Display 9*8.
Step 10: Display 9*9.
Step 11: Display 9*10.
Step 12: End the algorithm.

3.         Write an algorithm to find out whether a number entered by a user is even or odd.

Solution:
Step 1: Start the algorithm.
Step 2: Accept a number.
Step 3: Divide the number by 2.
Step 4: If the remainder is 0, the number is even.
Step 5: If the remainder is not 0, the number is odd.
Step 6: End the algorithm.

4.        Write an algorithm to accept two numbers from the user, subtract the first number from the second number, and display the result.

Solution:
Step 1: Start the algorithm.
Step 2: Get the first number.
Step 3: Get the second number.
Step 4: Subtract the first number from the second number.
Step 5: Display the result.

Step 6: End the algorithm.

1 comment: