Monday, 27 May 2013

Shell Script to find addition,subtraction,multiplication,mod of numbers(Calculator)

echo "Enter the two numbers to be added:"
read n1
read n2
sum=$(($n1+$n2))
sub=$(($n1-$n2))
mult=$(($n1*$n2))
div=$(($n1/$n2))
mod=$(($n1%$n2))
echo "Addition is :- "$sum
echo "Subtraction is :- "$sub
echo "Multiplication is :- "$mult
echo "Division is :- "$div
echo "Mod is :- "$mod

No comments:

Post a Comment