Answers for "write shell script for input two numbers and swap them without using third variable ."

1

swapping of two numbers without using third variable in shell script

#!/bin/bash
echo "enter first number"
read a
echo "enter second number"
read b
echo "a before swapping is $a and b is $b"
#swapping
a=$((a+b))
b=$((a - b))
a=$((a-b))
echo "a after swapping is  $a and b is $b"
Posted by: Guest on September-03-2020

Code answers related to "write shell script for input two numbers and swap them without using third variable ."

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language