This is a very general question of any interview in any programming language. But most of the developers not aware about the logic of this question.
Below is the solution of it see -
Output :
Before swapping the number is First=10 second=20
After swapping the number is First=20 second=10
You like this post don't forgot to leave a comment.
Chears :)
Happy coding
Below is the solution of it see -
$first = 10;
$second = 20;
echo "Before swapping the number is First=".$first." second=".$second.'<br>';
$first = $first + $second;
$second = $first - $second;
$first = $first - $second;
echo "After swapping the number is First=".$first." second=".$second;
Output :
Before swapping the number is First=10 second=20
After swapping the number is First=20 second=10
You like this post don't forgot to leave a comment.
Chears :)
Happy coding
ReplyDeleteAmazing post....I get to many things for the post, very helpful and informative for me.
i will again visit in this blog
@king jaan : Thanks and yes keep visiting..
ReplyDelete