Skip to content

Instantly share code, notes, and snippets.

@rdavane
rdavane / gist:e4e39c64b92def53cbf228176a59280d
Created December 9, 2017 07:41
swap 3 variables without using 4th
public class Test {
public static void main(String[] args) {
int x=1;
int y=2;
int z=3;
x=x+y;
y=x-y;
x=x-y;
@rdavane
rdavane / gist:bdd92c27798862b00812995cf1e7f452
Created December 9, 2017 06:54
print 12344321 123**321 12****21 1******1
public class Test {
public static void main(String[] args) {
for (int i = 4; i >= 1; i--) {
for (int j = 1; j <= 4; j++) {
if (j > i) {
System.out.print("*");
} else {
System.out.print(j);
}