Friday Lab2 Solution
Friday Lab2 Solution
Course CS101
Lab 2
Instructors: Bilal, Gullelala, Aisha (Group 6)
11/09/2015
Date:
1) Formulate an algorithm for: Obtain two numbers from the keyboard, and
determine and display which (if either) is the larger of two numbers.
Step1: Start
Step 2: Enter two numbers A and B
Step 3: Check if A is greater than B if yes go to Step 4 else go to Step 5
Step 4: Print A is greater than B
Step 5: Check if B is greater than A if yes go to Step 6 else go to Step 7
Step 6: Print B is greater than A
Step 7: Print A is equal to B
Step 8: Stop
2) Make a flowchart for the following scenario: Obtain a series of positive
numbers from keyboard, and determine and display the sum of the numbers.
Assume that the user types the sentinel value -1 to indicate end of data
entry.
Start
Sum = 0
Take numbers
Num >0
Display Sum
End
Sum = Sum
3) a) Convert the Hexadecimal number 95FF4 to Binary, Octal, and decimal
+ Num
number system.
Binary = 10010101111111110100
Octal = 2257764
Decimal = 614388