Linux Shell 脚本:找出 1000 到 100000 之间的幸运数字
#!/bin/bash for i in {1000..100000} do sum=0 temp=$i while [ $temp -gt 0 ] do remainder=$((temp % 10)) sum=$((sum + remainder)) temp=$((temp / 10)) done if [ $sum -eq 7 ] then echo $i fi done
原文地址: https://www.cveoy.top/t/topic/oOcJ 著作权归作者所有。请勿转载和采集!