Skip to main content
1 of 4
Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20

##Java: 151-5 = 146

Golfed:

class A{public static void main(String[]a){int n=new java.util.Scanner(System.in).nextInt();System.out.print(n%4==0?"1":n%4==1?"i":n%4==2?"-1":"-i");}}

Ungolfed:

class A {
    public static void main(String[] a) {
        int n = new java.util.Scanner(System.in).nextInt();
        System.out.print(n % 4 == 0 ? "1" : n % 4 == 1 ? "i" : n % 4 == 2 ? "-1" : "-i");
    }
}

Yes, yet another Java reply - and golfed even worse than ever. But you work with what you can...

Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20