1 2 3 4
5 6 7
8 9
10
I m trying to print the above output.
Below is my program in Java/Eclipse IDE. But my program gets terminated. Why my program is not showing any output? It straightaway gets terminated.
Code:
package One;
public class Forloop {
public static void main(String[] args) {
int k = 1;
for (int i = 4; i <= 1; i--) {
for (int j = 1; j <= i; j++) {
System.out.print(k);
System.out.print("t");
k++;
}
System.out.println(" ");
}
}
}
New contributor
Vaishnavi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.