qfedu-linux-advanced-level/day1/d23.sh

12 lines
245 B
Bash
Raw Permalink Normal View History

2023-08-14 17:48:45 +08:00
#!/bin/bash
# declare 是 Bash 内置命令,用于声明变量的属性,包括类型、作用域和初始值等。
declare -i total=0
for (( i=5;i<=100;i++ )); do
if (( i%5 == 0 )); then
total+=i
fi
done
echo "$total"