07-28-2023, 07:14 PM
There is factorial and there is fibonnaci
Code: (Select All)
' fibonacci series in micro(A)
var a, b, s, i ,n ,x ,y,r
str fbs,noe
fbs="fibonacci sequence in micro(A)"
wcolor 0,0,0 : fcolor 220,180,100
noe = "number of elements ->"
print 380,10,fbs
fcolor 80,140,120
print 380,30,noe
fcolor 100,200,200
a = 1
b = 1
n = 20
y = 50
label start
s = a + b
print 500,y,s
y = y + 20
a = b
b = s
i = i + 1
r=s/3.14
circle y,s,r : circle n,s,r : swap
if i < 23
goto start
endif
Code: (Select All)
'factorial micro(A)
var value,res
var number ,fact
number = 7
fact = 1
value = 1
print 10, 10, "The factorial of -> " :
print 180,10,number :swap
factorial()
fcolor 230,80,60: print 10,240,"RECURSION OVER!"
swap
func factorial()
if value < number
value = value + 1
fcolor 140,180,220: rect 95,95,80,23: print 100,100,value :swap
fact = fact * value
fcolor 240,180,120: rect 95,195,80,23 : print 100,200,fact :swap
' recursive call
factorial()
endif
endfn
micro(A)developer
http://basic4us.epizy.com/forum/index.php
http://basic4us.epizy.com/forum/index.php