write a program for the given pattern
1
12
123
1234
12345
Answers
Answered by
0
class pattern
{
public static void main (String args [])
{
System.out.println ("1");
System.out.println ("12");
System.out.println ("123");
System.out.println ("1234");
System.out.println ("12345");
}
}
{
public static void main (String args [])
{
System.out.println ("1");
System.out.println ("12");
System.out.println ("123");
System.out.println ("1234");
System.out.println ("12345");
}
}
Answered by
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);
}
}
}
Output:
1
12
123
1234
12345
Similar questions
Science,
7 months ago
English,
7 months ago
Math,
1 year ago
India Languages,
1 year ago
India Languages,
1 year ago