This Study Resource Was: Computer Organization and Assembly Languages
This Study Resource Was: Computer Organization and Assembly Languages
Lab 07
Instructions:
Work on this lab individually. Discussion is not allowed.
Evaluation of tasks will be conducted in lab.
Anyone caught being indulged in the act of plagiarism would be awarded an “F” grade in this
lab.
Task 02:
Write a program which should prompt user to press any key and display it’s ASSCII in binary.
The program should terminate when user press Esc. After displaying it’s ASSCII.
Sample Output:
Press any key: 2
ASCII: 00110010
Press any key:
m
ASCII: 00011011
er as
Good Bye !!!
co
eH w
Task 02:
o.
Write a program that prompts the user to type a hex number of four hex digits or less, and outputs it in
rs e
binary on the next line. If the user enters an illegal character, he or she should be prompted to begin
ou urc
again. Accept only uppercase letters.
Sample Output:
o
IN BINARY IT IS 0001101010111100
Your program may ignore any Input beyond four characters.
Task 03:
ed d
Write a program that prompts the user to enter two binary numbers of up to 8 digits each, and prints
ar stu
their sum on the next line in binary. If the user enters an illegal character, he or she should be prompted
to begin again. Each input ends with a carriage return.
is
Sample Output:
TYPE A BINARY NUMBER, UP TO 8 DIGITS: 11001010
Th
Task 04:
sh
Write a program that prompts the user to enter a string of decimal digits, ending with a carriage return,
and prints their sum on the next line. If the user enters an illegal character, he or she should be
prompted to begin again.
Areeba Ilyas
([email protected])
This study source was downloaded by 100000810677276 from CourseHero.com on 04-08-2021 10:07:21 GMT -05:00
https://www.coursehero.com/file/50328018/COAL-Lab-07pdf/
Computer Organization and Assembly Languages
Lab 07
Sample Output:
ENTER A DECIMAL DIGIT STRING: 1299843
THE SUM OF THE DIGITS IS 0036
Task 05:
Input a number from user and sum all multiples of that number below 100 then display.
Sample Output:
Enter a number (0~9): 4
Ans = 1200 ;(4+8+12+…+92+96)
m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh
Areeba Ilyas
([email protected])
This study source was downloaded by 100000810677276 from CourseHero.com on 04-08-2021 10:07:21 GMT -05:00
https://www.coursehero.com/file/50328018/COAL-Lab-07pdf/
Powered by TCPDF (www.tcpdf.org)