Arithmetic Operators Example 2

 #! bin/bash
echo "enter the num1 is:"
read num1
echo "enter the num2 is:"
read num2
echo "addition:" $((num1+num2))
echo "subtraction:" $((num1-num2))
echo "multiplication:" $((num1*num2))
echo "division:" $((num1/num2))


[prabhucloudxlab@cxln4 ~]$ sh 3sh.sh
enter the num1 is:
10
enter the num2 is:
20
addition: 30
subtraction: -10
multiplication: 200
division: 0


[prabhucloudxlab@cxln4 ~]$ sh 3sh.sh
enter the num1 is:
2.5
enter the num2 is:
2
3sh.sh: line 8: 2.5: syntax error: invalid arithmetic operator (error token is ".5")


Note:
##Note: -------------->> Decimal values error, for avoiding this we need to use SCALE

## scale defines how some operations use digits after the decimal point. The default value of scale is 0.

## BC, which stands for Basic Calculator, is a command in Bash that is used to provide the functionality of a scientific calculator within a Bash script


========================================================================

#! bin/bash
echo "enter the num1 is:"
read num1
echo "enter the num2 is:"
read num2
echo "scale=2;$num1+num2" | bc


[prabhucloudxlab@cxln4 ~]$ sh 3sh.sh
enter the num1 is:
2.5
enter the num2 is:
2
2.5