Computer Science, asked by Anonymous, 9 months ago

Write a Program in Java to print:
1
12
123
1234
12345

Answers

Answered by sunny7827
1

Answer:

for(int i=1;i<=size;i++) // first loop which is used to print the series up to size. for(int j=1;j<=i;j++) // second loop which prints the one line elements. 1 12 123 1234 12345. ( Here space means line change).

Explanation:

please follow me and add me in brainlist

Answered by atrs7391
0

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);

       }

   }

}

Similar questions