DeveloperBreeze

Swap Two Numbers Without Using a Temporary Variable

int a = 5, b = 10;

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

System.out.println("a = " + a + ", b = " + b);

Related Posts

More content you might like

Code
javascript

Prime Number Check and Prime Number Generation in JavaScript

No preview available for this content.

Jan 26, 2024
Read More
Code
python

Binary Search in Python

No preview available for this content.

Jan 26, 2024
Read More
Code
python

Generate Fibonacci Sequence

No preview available for this content.

Jan 26, 2024
Read More
Code
java

Calculate Factorial

No preview available for this content.

Jan 26, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!