Program to print 1
1 2
1 2 3
1 2 3 4 like that
Answer Posted / yagnik
public static void main(String args[]) throws
UnknownHostException, ClassNotFoundException
{
int count =5;
for(int i=1,h=5; i<count;i++){
for(int k=h;k>=0;k--)
{System.out.print(" ");}
for (int j=1 ;j<=i;j++){
System.out.print
(j);System.out.print(" ");
}
h--;System.out.println();
}
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is runtime polymorphism or dynamic method dispatch?
how to know the total memory occupied by the objects in the ArrayList(Array list may contain duplicate objects)
What are keyboard events?
How do you add an element to an arraylist in java?
What is immutable state?
What is keyword and identifier?
What are disadvantages of java?
What is yield () in java?
What is the purpose of the main method?
What is string builder?
Is an integer an object?
Can we convert list to set in java?
Which containers use a flowlayout as their default layout in java programming?
Can inner class extend any class?
How do generics work in java?