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 the difference between compile-time polymorphism and runtime polymorphism?
What string is utf8?
Why pass by reference is not possible in java?
What does the append?
Is null a value?
How do you check if a number is a perfect square?
how can i use a nonsynchronized hashtable?
What is the range of a character variable?
Can you run java program without main method?
How can we find the sum of two linked lists using stack in java?
Explain how to force the garbage collection in java.
What is the properties class?
How to implement a multithreaded applet?
Which methods cannot be overridden in java?
How static variable work in java?