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 latest java version?
What are the files generated after using IDL to java compiler?
Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?
If an object reference is set to null, will the garbage collector immediately free the memory held by that object?
What is the static block?
Can we have multiple catch block for a try block?
What are the differences between string, stringbuffer and stringbuilder?
Can a constructor be made final?
How can we pass argument to a function by reference instead of pass by value?
Name container classes in java programming?
Which methods cannot be overridden in java?
Explain about public and private access specifiers?
How do you generate random numbers in java?
what is meant wrapper classes?
What is the use of parseint in java?