write a Java program to print the following series :-. - 1 - 12 - 123
1234
12345
Answers
Answered by
1
Answer:
public class KboatPattern
{
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
for (int j = 4; j >= i; j--)
System.out.print(" ");
for (int k = 1; k <= i; k++)
System.out.print(k);
System.out.println();
}
}
}
OUTPUT
BlueJ output of Write a program in Java to display the following pattern: 1 12 123 1234 12345
Answered by
1
class pattern {
public static void main(String[] args) {
int counter = 0;
for (int i = 1; i <= 5; i++) {
counter = counter*10+i;
System.out.println(counter);
}
}
}
Similar questions
English,
6 hours ago
Physics,
6 hours ago
Math,
6 hours ago
Geography,
12 hours ago
Environmental Sciences,
8 months ago