An MBA in finance imparts and improves management aptitude, inventive ability, critical thinking ability, and so forth. It offers a real-time experience that fabricates a staunch career foundation for students and working professionals. It helps them to thoroughly understand the financial sector.
public class SwapNumberWithoutThierdVariable{ public static void swapNumbers(int a, int b) {
b = b + a;
a = b - a;
b = b - a;
}
public static void main(String[] args) {
int a = 10;
int b = 20;
swapNumbers(a, b);
System.out.printf("a is %d, b is %d", a, b); // a is 10, b is 20
} }
Liked By
Write Answer
How to swap two numbers without using a third variable?
Join MindStick Community
You have need login or register for voting of answers or question.
Mukul Goenka
16-Nov-2021