Arm thumb program to find first 10 fibonacci numbers

 

In this article let’s learn how to find first 10 Fibonacci numbers.Usually Fibonacci numbers start from 0,1,1,2……In this, we can observe that the present number in Fibonacci is the summation of previous two numbers. So in this, we should initialize first two numbers as -1 and +1 so that our algorithm works fine.

Let’s see how the algorithm works.

Algorithm:

1)Start
2)Initialize R0 with -1, R1 with +1, counter R4 with 10 and first memory location with R2
3) Add R0 and R1
4)Store the result in the memory address
5)Increment the pointer
6)Change R0 and R1 i.e store the added result in R1 and store R1 in R0 by taking temporary variable     R3
7)Decrement the pointer and compare.
8)If the counter is less then repeat step 3,4,5,6,7,8
9)Stop

Code goes here:

Thank you visit again 🙂 You can also visit our 8051 code to find Fibonacci numbers. Click Here!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Advertisment ad adsense adlogger