Shell program - swapping of two numbers without using third variable

CODE:

#! /bin/bash

echo "enter two numbers:"
read a
read b
c=`expr "$a" - "$b" `

echo "$a - $b ="$c

OUTPUT:

Shell program - swapping of two numbers without using third variable

Shell program - swapping of two numbers using third variable

CODE:

#! /bin/bash

echo "enter two numbers:"
read a
read b
echo "Before swapping, a=$a and b=$b"
z=$a
a=$b
b=$z

echo "After swapping, a=$a and b=$b"

OUTPUT:
Shell program - swapping of two numbers using third variable

Shell program - Division of two numbers

CODE:

#! /bin/bash

echo "enter two numbers:"
read a
read b
c=`expr "$a" \/ "$b" `

echo "$a / $b ="$c


OUTPUT:

Shell program - Division of two numbers

Shell program - Multiplication of two numbers

CODE:

#! /bin/bash

echo "enter two numbers:"
read a
read b
c=`expr "$a" \* "$b" `

echo "$a * $b ="$c


OUTPUT:

Shell program - Multiplication of two numbers

Shell program - Subtraction of two numbers

CODE:

#! /bin/bash

echo "enter two numbers:"
read a
read b
c=`expr "$a" - "$b" `

echo "$a - $b ="$c

OUTPUT:

Shell program - Subtraction of two numbers


Shell program - Addition of two numbers

CODE:

#! /bin/bash

echo "enter two numbers:"
read a
read b
c=`expr "$a" + "$b" `

echo "$a + $b ="$c

OUTPUT:

Shell program - Addition of two numbers