l kasd dcklj dkjc qwkdj khd ckjndkjc dn kjd Program to find 10 fibonacci numbers and store it an array. In this article let's learn how to find fibonacci numbers and store it in an array. Basically fibonacci number is a series where each term is the sum of previous two numbers. Algorithm: 1)Store the memmory address in R0 and counter in R3. 2)Store first two numbers that is 0 and 1 in memory space. 3)Add the previous two numbers and store in an memory space. 4)Exchange the registers and store the previous two numbers. 5)Repeat the steps 2,3 and 4 till the counter value becomes zero. Code goes here: ORG 0000h LJMP MAIN ORG 40h MAIN: MOV R0,#40H ;Memory space where all the fibonacci numbers are stored MOV R3,#8 ; Move number of fibonacci numbers to be generated MOV R1,#00H MOV @R0,#0H ;Move the first number in the memory space INC R0 MOV @R0,#01H ;Move the second number in the memory space ...
Comments
Post a Comment