From d41c03feafb17ed599e6e2f6891ff12c87534104 Mon Sep 17 00:00:00 2001 From: ADITYA DUBEY <75172576+adidubs@users.noreply.github.com> Date: Mon, 10 Oct 2022 22:02:26 +0530 Subject: [PATCH] Create swapTwoNumber.cpp Swap two numbers. --- swapTwoNumber.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 swapTwoNumber.cpp diff --git a/swapTwoNumber.cpp b/swapTwoNumber.cpp new file mode 100644 index 0000000..a956a99 --- /dev/null +++ b/swapTwoNumber.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; + +int main() +{ + int a = 5, b = 10, temp; + + cout << "Before swapping." << endl; + cout << "a = " << a << ", b = " << b << endl; + + temp = a; + a = b; + b = temp; + + cout << "\nAfter swapping." << endl; + cout << "a = " << a << ", b = " << b << endl; + + return 0; +}