Write a Linux shell script that performs simple arithmetic operation on given input, Unix program to performs simple arithmetic operation i.e addition, multiplication, division, subtraction, modules
Program
clear
echo "Enter first no :"
read a
echo "Enter second no :"
read b
echo "1. Addition"
echo "2. Subtraction"
echo "3. Multiplication"
echo "4. Division"
echo "5. Modulo operation"
echo "6. Exit"
echo "Enter your choice :"
read ch
case $ch in
1) echo Answer = 'expr $a+ $b';;
2) echo Answer = 'expr $a- $b';;
3) echo Answer = 'expr $a\*$b';;
4) echo Answer = 'expr $a/$b';;
5) echo Answer = 'expr $a%$b';;
6) exit
esac
<<< Previous || Current || Next >>>
No comments:
Post a Comment