qfedu-linux-advanced-level/day1/homework/h2.sh

11 lines
205 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 编写一个Shell脚本计算1到100之间所有3倍数的整数和svi
declare -i svi=0
for (( i=1;i<=100;i++ )); do
if (( i%3==0 )); then
svi+=i
fi
done
echo "svi="$svi