Linux shell编程求3位数水仙花数
#!/bin/bash for ((a=1;a<10;a++)) do for((b=0;b<10;b++)) do for((c=0;c<10;c++)) do p=$((a*100+b*10+c)) q=$((a**3+b**3+c**3)) if [ $p -eq $q ];then echo "$p" fi done done done
linux log/cgj> ./narcis_number.sh
153
370
371
407