158k views
5 votes
NO LINKS

write a shell script to find the sum of all integers between 100 and 200 which are divisible by 9​

User Janelly
by
8.1k points

1 Answer

2 votes

Answer:

#!/usr/bin/env bash

for num in {100..200}

do

if [ $((num % 9)) -eq 0 ]

then

((sum += num))

fi

done

echo $sum

Step-by-step explanation:

The output will be 1683.

User Rogervila
by
8.0k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.