C# program to swap two numbers with and without using third variable
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Consider the program:
Output
2) Swapping without using third variable
Here, we do not use any extra variable to swap the numbers. There are some set of statements (with mathematical operations which performs on the numbers), which swaps the values of variable which are using in these operations.
Example: If we have to swap the values of variable a and b, then the set of statements to swap them, are:
Consider the program:
Output