0% found this document useful (0 votes)
35 views2 pages

Friday Lab2 Solution

The document contains solutions to three coding problems: 1) An algorithm to determine the larger of two input numbers in 8 steps. 2) A flowchart to sum a series of positive numbers input until a sentinel value of -1. 3) Conversions between binary, octal, decimal, and hexadecimal number systems for various input values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Friday Lab2 Solution

The document contains solutions to three coding problems: 1) An algorithm to determine the larger of two input numbers in 8 steps. 2) A flowchart to sum a series of positive numbers input until a sentinel value of -1. 3) Conversions between binary, octal, decimal, and hexadecimal number systems for various input values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Activity (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

b) Convert the Decimal number 05953 to Binary, Octal and Hexadecimal


number system.
Binary = 1101101100000101100101010011
Octal = 1554054523
Hexadecimal = ECB1
c) Convert the Octal number 75431 to Binary, Decimal and Hexadecimal
number system.
Binary = 111101100011001
Decimal = 31321
Hexadecimal = 7B19
d) Convert the Binary number 101100101101 to Octal, Decimal and
Hexadecimal number system.
Octal= 5455
Decimal = 2861
Hexadecimal = B2D

You might also like