当前位置:网站首页>The for loop realizes 1-100 addition and eliminates the 4-digit tail number

The for loop realizes 1-100 addition and eliminates the 4-digit tail number

2022-07-07 23:33:00 Bobo in summer

#!/bin/bash
i_End=4
i_Total=0
for((i=1;i<=100;i++))
do
	i_temp=`expr $i % 10`
	if [ $i_temp -eq $i_End ];
	then
		echo " skip :${i}"
		continue;
	fi
	
   i_Total=$((${
    i_Total}+i))
done

echo "Total=${i_Total}"
原网站

版权声明
本文为[Bobo in summer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130558212362.html