Computer Science, asked by anki469, 10 months ago

Write a Java program to create the following pattern using nested for
loop.
1
12
123
1234
12345

Answers

Answered by Crystak
0

Refer to the attachments.

Attachments:
Answered by atrs7391
1

Easiest program:

package com.company;  

public class Main {

  public static void main(String[] args) {

      int s = 0;

      for (int i = 1; i <= 5 ; i++) {

          s = s*10+i;

          System.out.println(s);

      }

  }

}

Output:

1

12

123

1234

12345

Similar questions