Question

write a code segment for a loop to calculate the sum of first 10 odd numbers...

write a code segment for a loop to calculate the sum of first 10 odd numbers [what your program computes is 1+3+5+7+9+11+13+15+17+19. store the result in register r0.]


it’s assembly language
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ARM ASSEMBLY CODE :- ( r0 = result ; r1 = odd number starting )

FUNC:
   mov r0,#0
   mov r1,#1
LOOP_START:
   add r0,r0,r1
   add r1,r1,#2
   cmp r3,#19
   ble LOOP_START

Add a comment
Know the answer?
Add Answer to:
write a code segment for a loop to calculate the sum of first 10 odd numbers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assume the variable LIST is defined as a list of numbers. Write a code segment that...

    Assume the variable LIST is defined as a list of numbers. Write a code segment that utilizes a loop to total up all of the numbers in the list up to, but not including, the first negative number. Store the result in the variable TOTAL. % test cases % LIST = [ 1 4 6 -2 7 9]; TOTAL = 11; % LIST = [ -2 4 5 7 9]; TOTAL = 0; % your code segment here %----------------------- %...

  • Write a function to calculate the sum of the reciprocals of a series of odd numbers....

    Write a function to calculate the sum of the reciprocals of a series of odd numbers. The function will have one input and no output, with the input being the ending value for the series of odd values. Write the function definition statement Initialize a variable to zero. This variable will contain the sum of all the values. Create a for loop that loops over all odd numbers from 1 to the specified ending value. Inside the loop, add the...

  • Write a python function that prints all odd numbers between two given numbers print_odd_numbers(10,20) → 11...

    Write a python function that prints all odd numbers between two given numbers print_odd_numbers(10,20) → 11 13 15 17 19 print_odd_numbers(4,12) → 5 7 9 11 ### Your code here def print_odd_numbers(n1, n2):   

  • メ01 2. Assuming register Sto is initialized to an even number N, w rite a loop to calculate the ...

    メ01 2. Assuming register Sto is initialized to an even number N, w rite a loop to calculate the SUM of all even numbers from 0 to N in a loop style execution. Write MIPS Assembly code and place the result in register Ss0. メ01 2. Assuming register Sto is initialized to an even number N, w rite a loop to calculate the SUM of all even numbers from 0 to N in a loop style execution. Write MIPS Assembly...

  • can you also help me for this in the same way. Write a program in ARM...

    can you also help me for this in the same way. Write a program in ARM assembly to calculate the sum of the first 10 even numbers. Leave the result in register R0 at the end of your program.

  • Write a C program to sum up all the odd numbers between a lower limit number...

    Write a C program to sum up all the odd numbers between a lower limit number and an upper limit number provided by a user. The requirements are: First, request the user to provide a lower limit integer number and an upper limit integer number that is larger than the lower limit number, and save them in variables lowerLimit and upperLimit, respectively. If the user has entered an upper limit number (upper Limit) that is NOT larger than the lower...

  • Write a program using the LOOP instruction to sum all the even numbers from 20H to...

    Write a program using the LOOP instruction to sum all the even numbers from 20H to 80H. Write a program using the ADC (or add with carry) instruction to add these two 48 bit numbers. Assume the first number is store at an address starting 400H and that the second number is stored at an address starting at address 500H. Store the results in memory starting at address 600H. (Note that each number consists of three 16 bit words). Show...

  • . Write an 8086 assembly language program to find the prime numbers among 100 bytes of...

    . Write an 8086 assembly language program to find the prime numbers among 100 bytes of data in an array stored from the address 4000H: 1000H in the data segment and store the result from the address 4000H: 3000H. write the code using 8086 assembly language only i do not want any other language If you Do not sure please do not solve it

  • CDA-3101 – MIPS Assembly Programming 1. Write the following code segment in MIPS assembly language code:...

    CDA-3101 – MIPS Assembly Programming 1. Write the following code segment in MIPS assembly language code: 3. Write a MIPS program to find the sum of squares from 1 to n. Where n=10. For example, the sum of squares for 10 is as follows: 12+22+32+……+n2=385

  • Write a for loop that assigns summed Value with the sum of all odd values from...

    Write a for loop that assigns summed Value with the sum of all odd values from 1 to user Num. Assume userNum is always greater than or equal to 1. Ex: If userNum is 5, then summed Value is 9 (i.e. 1+3+5 =9). Function Save C Reset MATLAB Documentation 1 function summedValue - Oddssum(userNum) summedValue = 0; % Write a for loop that assigns summedValue with the % sum of all odd values from 1 to user Num 7 end...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT