Skip to main content
Commonmark migration
Source Link

#Java, 99 bytes

Java, 99 bytes

void f(int a){int[]f=new int[2];while(++f[0]<=a){f[1]=f[0];while(f[1]>0)System.out.print(f[1]--);}}

EDIT 1: Saved few bytes by changing it from a full program to a function.

Ungolfed:

void f(int a) {
    int[] f = new int[2];
    while (++f[0] <= a) {
        f[1] = f[0];
        while (f[1] > 0) System.out.print(f[1]--);
    }
}

#Java, 99 bytes

void f(int a){int[]f=new int[2];while(++f[0]<=a){f[1]=f[0];while(f[1]>0)System.out.print(f[1]--);}}

EDIT 1: Saved few bytes by changing it from a full program to a function.

Ungolfed:

void f(int a) {
    int[] f = new int[2];
    while (++f[0] <= a) {
        f[1] = f[0];
        while (f[1] > 0) System.out.print(f[1]--);
    }
}

Java, 99 bytes

void f(int a){int[]f=new int[2];while(++f[0]<=a){f[1]=f[0];while(f[1]>0)System.out.print(f[1]--);}}

EDIT 1: Saved few bytes by changing it from a full program to a function.

Ungolfed:

void f(int a) {
    int[] f = new int[2];
    while (++f[0] <= a) {
        f[1] = f[0];
        while (f[1] > 0) System.out.print(f[1]--);
    }
}
deleted 416 characters in body
Source Link
user63331
user63331

#Java, 12399 bytes

interface y{static void mainf(String[]s){int a=new Integer(s[0]a),c=0,i;while{int[]f=new int[2];while(++c<=a++f[0]<=a){i=c;whilef[1]=f[0];while(i>0f[1]>0)System.out.print(if[1]--);}}}

Takes input as command line argumentEDIT 1: Saved few bytes by changing it from a full program to a function.

Ungolfed with comments:

interface y{
    static void mainf(String[] s) {
        int a = new Integer(s[0]),          // Input number{
               int[] cf = 0,                      // Counter 1
                i;                          // Counternew 2int[2];
        while (++c++f[0] <= a) {                  // Increment counter 1. Until counter 1 is less or equal to input
            i = c;                          // Counter 2f[1] = counter 1f[0];
            while (if[1] > 0)                   // Until counter 2 is more than 0
                System.out.print(if[1]--);      // Output counter 2 and decrement it
        }
    }
}

#Java, 123 bytes

interface y{static void main(String[]s){int a=new Integer(s[0]),c=0,i;while(++c<=a){i=c;while(i>0)System.out.print(i--);}}}

Takes input as command line argument.

Ungolfed with comments:

interface y{
    static void main(String[] s) {
        int a = new Integer(s[0]),          // Input number
                c = 0,                      // Counter 1
                i;                          // Counter 2
        while (++c <= a) {                  // Increment counter 1. Until counter 1 is less or equal to input
            i = c;                          // Counter 2 = counter 1
            while (i > 0)                   // Until counter 2 is more than 0
                System.out.print(i--);      // Output counter 2 and decrement it
        }
    }
}

#Java, 99 bytes

void f(int a){int[]f=new int[2];while(++f[0]<=a){f[1]=f[0];while(f[1]>0)System.out.print(f[1]--);}}

EDIT 1: Saved few bytes by changing it from a full program to a function.

Ungolfed:

void f(int a) {
    int[] f = new int[2];
    while (++f[0] <= a) {
        f[1] = f[0];
        while (f[1] > 0) System.out.print(f[1]--);
    }
}
Source Link
user63331
user63331

#Java, 123 bytes

interface y{static void main(String[]s){int a=new Integer(s[0]),c=0,i;while(++c<=a){i=c;while(i>0)System.out.print(i--);}}}

Takes input as command line argument.

Ungolfed with comments:

interface y{
    static void main(String[] s) {
        int a = new Integer(s[0]),          // Input number
                c = 0,                      // Counter 1
                i;                          // Counter 2
        while (++c <= a) {                  // Increment counter 1. Until counter 1 is less or equal to input
            i = c;                          // Counter 2 = counter 1
            while (i > 0)                   // Until counter 2 is more than 0
                System.out.print(i--);      // Output counter 2 and decrement it
        }
    }
}