Skip to content

Commit

Permalink
swapping of two numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Amitesh-tiwari committed Apr 29, 2024
1 parent f9827c3 commit 72da526
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions SwapTwoNumbers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
roblem statement
You are given two numbers 'a' and 'b' as input.

You must swap the values of 'a' and 'b'.

For Example:
Input:
'a' = 8, 'b' = 5

//code

void swapNumber(int &a, int &b) {

a = a+b;
b = a-b;
a = a-b;

}

0 comments on commit 72da526

Please sign in to comment.