Q. How do I swap two numbers without using addition and subtraction in Bash
Ans:
#!/bin/bash read -p "Enter first number :" first read -p "Enter second number:" sec echo "" echo -e "Number before swapping is $first and $sec \n" #swapping logic first=$((first*sec)) sec=$((first/sec)) first=$((first/sec)) echo -e "Number after swapping is $first and $sec \n"
Output
Enjoy :)
If You Liked This Post Please Take a Time To Share This Post
have read your blog its very attractive and impressive. I like it your blog.
ReplyDeletePHP 7 Training in chennai | PHP 7 Training Course
PHP 7 Training in chennai | Online PHP 7 Course
This is very informative and interesting blog post site. Thanks for sharing it.
ReplyDeletehttps://www.lovingparents.in/kids/kids-5-12-years/7-common-childhood-illnesses-and-their-treatments/
This is very information and interesting blog post site which is related to swapping two numbers.
ReplyDeletehttps://www.lovingparents.in/kids/kids-5-12-years/7-common-childhood-illnesses-and-their-treatments/
Your words are incredibly uplifting; thank you for sharing such positivity! IOGames Top is my go-to site for the best free online games! The collection is huge and always growing. Highly recommend! Check it out and start playing today!
ReplyDelete