Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!