answersLogoWhite

0

public class equitraingle {

public static void main(String[ ] args) {

int numrows=6; // changing the value of numrows,respective o/p will be printed

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

for(int j=1;j<numrows-i;j++)

{

System.out.print(" ");

}

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

System.out.print(k+" ");

}

System.out.println("");

}

}

}

o/p:

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
JudyJudy
Simplicity is my specialty.
Chat with Judy
FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran

Add your answer:

Earn +20 pts
Q: How can iwrite java program to print programming in triangle form?
Write your answer...
Submit
Still have questions?
magnify glass
imp