Shell实现斐波那契数列计算斐波那契数计算器 (numberempire.com) 123456789101112131415161718192021222324252627282930#!/bin/bashfibonacci() { n=$1 if [ $n -eq 0 ]; then echo 0 elif [ $n -eq 1 ]; then echo 1 else a=0 b=1 i=2 while [ $i -le $n ]; do c=$((a + b)) a=$b b=$c i=$((i + 1)) done echo $b fi}read -p "请输入N值(N < 50): " Nif [ $N -ge 0 ] && [ $N -lt 50 ]; then result=$ ...