Study Area Facebook粉絲團http://www.facebook.com/sataiwan
0 會員 與 1 訪客 正在閱讀本文。
n1=0n2=1max=${1-0}if [ "$max" -le 1 ]; then echo Not positive integer. exitfi((max-=2))echo -n "Fib=$n1,$n2"for ((i=1;i<=$max;i++)); do n=$((n1+n2)) echo -n ",$n" n1=$n2 n2=$ndoneecho
n = int(raw_input("Please enter an integer: "))a, b = 0, 1while b < n: print b, a, b = b, a+b