14 lines
206 B
Bash
14 lines
206 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
declare -i n
|
||
|
read -p "请输入一个整数: " n
|
||
|
|
||
|
for (( i=2; i<n; i++ )); do
|
||
|
if (( n%i == 0)); then
|
||
|
echo "$n 不是素数"
|
||
|
exit 1
|
||
|
fi
|
||
|
done
|
||
|
echo "$n 是素数"
|
||
|
|
||
|
echo "$n"
|