Skip to main content
Commonmark migration
Source Link

Java, 151 128 77 62 56 bytes

#Java, 151 128 77 62 56 bytes FirstFirst try at code-golfing.

void f(int n){for(char i=0;++i<=n;System.out.print(i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        for (char i = 0; ++i <= n; System.out.print(i));
    }
}

Thanks to @Shujal, @flawr, @Ingo Bürk and @Loovjo for the serious byte reduction.

#Java, 151 128 77 62 56 bytes First try at code-golfing.

void f(int n){for(char i=0;++i<=n;System.out.print(i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        for (char i = 0; ++i <= n; System.out.print(i));
    }
}

Thanks to @Shujal, @flawr, @Ingo Bürk and @Loovjo for the serious byte reduction.

Java, 151 128 77 62 56 bytes

First try at code-golfing.

void f(int n){for(char i=0;++i<=n;System.out.print(i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        for (char i = 0; ++i <= n; System.out.print(i));
    }
}

Thanks to @Shujal, @flawr, @Ingo Bürk and @Loovjo for the serious byte reduction.

First try at code-golfing.

#Java -, 151 128 77 62 56 bytes First try at code-golfing.

void f(int n){for(char i=0;++i<=n;System.out.print(i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        for (char i = 0; ++i <= n; System.out.print(i));
    }
}

Thanks to Shujal@Shujal, flawr@flawr, Ingo@Ingo Bürk and Loovjo@Loovjo for the serious byte reduction.

First try at code-golfing.

#Java - 151 128 77 62 56 bytes

void f(int n){for(char i=0;++i<=n;System.out.print(i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        for (char i = 0; ++i <= n; System.out.print(i));
    }
}

Thanks to Shujal, flawr, Ingo Bürk and Loovjo for the serious byte reduction.

#Java, 151 128 77 62 56 bytes First try at code-golfing.

void f(int n){for(char i=0;++i<=n;System.out.print(i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        for (char i = 0; ++i <= n; System.out.print(i));
    }
}

Thanks to @Shujal, @flawr, @Ingo Bürk and @Loovjo for the serious byte reduction.

Golfed code
Source Link
Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20

First try at code-golfing.

#Java - 151 128 77 6262 56 bytes

void f(int n){int i=0;forfor(;++i<=n;Systemchar i=0;++i<=n;System.out.print((char)i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        intfor (char i = 0;
        for (; ++i <= n; System.out.print((char) i));
    }
}

Thanks to Shujal, flawr and, Ingo Bürk and Loovjo for the serious byte reduction.

First try at code-golfing.

#Java - 151 128 77 62 bytes

void f(int n){int i=0;for(;++i<=n;System.out.print((char)i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        int i = 0;
        for (; ++i <= n; System.out.print((char) i));
    }
}

Thanks to Shujal, flawr and Ingo Bürk for the serious byte reduction.

First try at code-golfing.

#Java - 151 128 77 62 56 bytes

void f(int n){for(char i=0;++i<=n;System.out.print(i));}

Usage:

import java.util.Scanner;
class A {

    public static void main(String[] a) {
        int num = new Scanner(System.in).nextInt();
        new A().f(num);
    }

    void f(int n) {
        for (char i = 0; ++i <= n; System.out.print(i));
    }
}

Thanks to Shujal, flawr, Ingo Bürk and Loovjo for the serious byte reduction.

added 8 characters in body
Source Link
Ingo Bürk
  • 2.7k
  • 2
  • 16
  • 27
Loading
Golfed the code a bit more.
Source Link
Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20
Loading
Edited code
Source Link
Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20
Loading
Edited code
Source Link
Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20
Loading
deleted 2 characters in body
Source Link
Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20
Loading
Source Link
Rodolfo Dias
  • 4k
  • 2
  • 14
  • 20
Loading