C++ Program to Swap Two Numbers
C++ Program to Swap Two Numbers
In programming, there are two different techniques to swap any two numbers in a variable, they are
- Swap using Temporary Variable
- Swap without using Temporary Variable
Swap using Temporary Variable
In the following example, we will swap two numbers (25 and 50) using a temporary variable (temp).
Example
Output
Swap without using Temporary Variable
In the following example, we will swap two numbers (25 and 50) without using a temporary variable.
Example
Output
Swap any Two Given Numbers
In the following example, we will swap any two given numbers without using a temporary variable (temp).
Example
Output
Reminder
Hi Developers, we almost covered 90% of String functions and Interview Question on C++ with examples for quick and easy learning.
We are working to cover every Single Concept in C++.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.