Question
IN ASSEMBLY Complete the code to find the sum of the series 1 +11 + 111 + 1111 + .. n terms. Your function receives
IN ASSEMBLY
Complete the code to find the sum of the series 1 +11 + 111 + 1111 + .. n terms. Your function receives n and you should move your output to the variable called sum.
Your result only needs to be 32 bits long (the max size of any of your registers), so dont worry about overflows for n>= 10. EX.: n = 2 Output = 12 (1+11) EX.: n = 3 Output = 123 (1+11+111) EX.: n = 5 Output = 12345 (1+11+111+1111+11111)
PART 1: Complete the code to find the sum of the series 1 +11 + 111 + 1111 + .. n terms. Implementation details:
The input integer n is stored in register EBX. Do not forget to move your result to the variable 'sum'.
************************************************************************************************/
unsigned int seriesSum(int n)
{
unsigned int sum=0; __asm
{ mov ebx, n
// YOUR CODE STARTS HERE
// YOUR CODE ENDS HERE
}
return sum;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started