Fibo Dengan Array Pada Shell Programming

#!/bin/bash clear echo -n "Masukkan Jumlah deret Fibonacci :" read n fib[0]=0 fib[1]=1 a=0 b=1 for (( i=2; i<$n; i++ )) do fib[$i]=`expr ${fib[$i-1]} + ${fib[$i-2]}` done for (( i=0; i<$n; i++ )) do for (( j=0; j<=$i; j++ )) do printf "${fib[$j]} " done echo "" done
Tinggal ganti-ganti variabel aja...
Have a nice day ya...

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.