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

This Study Resource Was: Computer Organization and Assembly Languages

This document outlines 5 tasks for a computer organization and assembly languages lab. The tasks involve writing programs to: 1) prompt a user to press a key and display its ASCII in binary; 2) prompt a user for a hex number and display it in binary; 3) prompt users for two binary numbers and display their sum; 4) prompt a user for decimal digits and display their sum; and 5) prompt a user for a number and display the sum of its multiples below 100. The document provides sample outputs for each task.

Uploaded by

furqan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views2 pages

This Study Resource Was: Computer Organization and Assembly Languages

This document outlines 5 tasks for a computer organization and assembly languages lab. The tasks involve writing programs to: 1) prompt a user to press a key and display its ASCII in binary; 2) prompt a user for a hex number and display it in binary; 3) prompt users for two binary numbers and display their sum; 4) prompt a user for decimal digits and display their sum; and 5) prompt a user for a number and display the sum of its multiples below 100. The document provides sample outputs for each task.

Uploaded by

furqan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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

TYPE A HEX NUMBER (0 TO FFFF): 1a


aC s

ILLEGAL HEX DIGIT, TRY AGAIN: 1ABC


vi y re

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

TYPE A BINARY NUMBER, UP TO 8 DIGITS: 10011100


THE BINARY SUM is 101100110

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)

You might also like