Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROGRAM 5 : Real Big Number! Write an HLA Assembly language program that prompts for n , an int 8 value, and then displays a

PROGRAM 5: Real Big Number!
Write an HLA Assembly language program that prompts for n, an int8 value, and then displays a repeated digit pattern starting with that number. The repeated digit pattern should print all the values from 1 up to n then all the values from 1 up to n-1 then all the values 1 up to n-2... then all the values 1 up to 2 and end with a single 1. Shown below is a sample program dialogue.
Gimme a decimal value to use for n: 5
Here's your answer: 123451234123121
Gimme a decimal value to use for n: 8
Here's your answer: 123456781234567123456123451234123121
(Hint: The digit pattern is too large to store into any datatype we have learned to date so I am expecting that you will use a loop with CMP instructions and a conditional jump to print individual digits, rather than store the complete number in a variable, just like the sample programs in this unit demonstrate)
(Additional Hint: You should not be using high language statements like for, while or repeat loops, as these are not assembly instructions are off limits in this course.)
Withoug using high level programming such as loops and if statements.
Here is my c code that works but want to convert to HLA assembly
#include
void printDigitPattern(int n){
int i, j;
for (i =1; i <= n; ++i){
for (j =1; j <= i; ++j){
printf("%d", j);
}
}
for (i = n -1; i >=1; --i){
for (j =1; j <= i; ++j){
printf("%d", j);
}
}
printf("1
"); // End with a single '1' and newline
}
int main(){
int n;
printf("Gimme a decimal value to use for n: ");
scanf("%d", &n);
printf("Here's your answer: ");
printDigitPattern(n);
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

OUTCOME 3 Describe pay equity and strategies for implementing it.

Answered: 1 week ago