swap two variables without temporary java
import java.*; class noTemp { public static void main(String a[]) { int x = 10; int y = 5; x = x + y; y = x - y; x = x - y; System.out.println("After swaping:" + " x = " + x + ", y = " + y); } }
swap two variables without temporary java
import java.*; class noTemp { public static void main(String a[]) { int x = 10; int y = 5; x = x + y; y = x - y; x = x - y; System.out.println("After swaping:" + " x = " + x + ", y = " + y); } }
Swapping of two numbers in java with temporary variable
public class Main{public static void main(String[] args) {float a = 3.66f, b = 6.47f;System.out.println("a number " + a);System.out.println("b number " + b);float temp = a;a = b;b = temp;System.out.println("After swapping");System.out.println("a number " + a);System.out.println("b number " + b);}}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us