Wednesday, 11 December 2013

Unknown

1 to 10 Display Triangle


/*
1
2 3
4 5 6
7 8 9 10 ... N */
class Output1 {

    public static void main(String args[]) {
        int c = 0;
        int n = Integer.parseInt(args[0]);
        loop1:
        for (int i = 1; i <= n; i++) {
            loop2:
            for (int j = 1; j <= i; j++) {
                if (c != n) {
                    c++;
                    System.out.print(c + " ");
                } else {
                    break loop1;
                }
            }
            System.out.print("\n");
        }
    }
}

Unknown

About Blog No Baap -

Since 2016 BlogNoBaap has been bringing you the very best in all types of web resources. Posted daily, and delivered straight to your inbox each morning.

Subscribe to this Blog via Email :