Shell Script to perform the arithmetic operations using case.

 Shell Script:

echo '\tEvaluation of Arithmetic expression'
echo '\tEvaluation of Arithmetic expression'
echo Enter the a value
read a
echo  Enter the b value
read b
echo 1.Addition
echo 2.Subtraction
echo 3.Multiplication
echo 4.Division
echo 5.Modules
echo Enter your choice
read choice
case $choice in
        1)echo Addition       : $(expr $a + $b);;
        2)echo Subtraction   : $(expr $a - $b);;
        3)echo Multiplication : $(expr $a \* $b);;
        4)echo Division       : $(expr $a / $b);;
        5)echo Modules        : $(expr $a % $b);;
        *)echo This is not a choice
esac


Output:



AJ Blogs

Hello everyone, My name Arth and I like to write about what I learn. Follow My Website - https://sites.google.com/view/aj-blogs/home

Post a Comment

Previous Post Next Post
Best Programming Books

Facebook

AJ Facebook
Checkout Our Facebook Page
AJ Blogs
Checkout Our Instagram Page