Dear Friend,
Modulo or modulus operation finds the reminder of division of one number by another. Mathematical operator is %. For instance, 5%3=2.
Now, here is the script:
Code:
#!/bin/bash
read -p "First integer: " num1
read -p "Second integer: " num2
# Addition
echo "Sum = $((num1+num2))"
# Subtraction
echo "Difference = $((num1-num2))"
# Multiplication
echo "Product = $((num1*num2))"
if [ $num2 -eq 0 ]
then
echo "Division and modulus are not possible."
exit 0
fi
# Division
echo "Division = $((num1/num2))"
# Modulus
echo "Modulus = $((num1%num2))"
Let me know if this helps
Thanks,
Lijeesh