Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Java - Swap two numbers without using temp var
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int x = 10; int y = 15; x = x + y; // 25 temp x y = x - y; // 25 - 15 = 10 x = x - y; // 25 - 10 = 15 System.out.println("x = " + x); System.out.print("y = " + y); } }
run
|
edit
|
history
|
help
0
ZonedDateTime testing
Coding Challenge - 01 (Even numbers)
Integer to English Words
String reverse
exp5
Satish Shankar Nikam
Rotate matrix clockwise
Ip address
H
Project Euler #2