Answer:
#!/bin/bash
function number_div( ) {
for i in {0. .100};
do
if (( $i % 3 == 0 ))
then
echo $i
elif (( $i % 5 == 0 ))
then
echo $i
else
echo "Number not divisible by 3 and 5"
fi;
done
}
number_div( )
Step-by-step explanation:
The bash script is saved as "HW4p2.sh" and executed as "./HW4p2.sh". This code would print all and only numbers divisible by 3 or 5.