Program to print 1
1 2
1 2 3
1 2 3 4 like that
Answer Posted / aditya
public class pattern
{
public static void main(int n)
{
int i,j,k;
for(i=1;i<=n;i++)
{
for(j=n;j>i;j--)
{
System.out.print(" ");
}
for(k=1;k<=i;k++)
{
System.out.print(+k+" ");
}
System.out.println();
}
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is return used for in java?
How do you square a number in java?
How many classes can any class inherit java?
Why is it called buffering?
how to one war file class to another war file class?
What is an object in java?
What is generic type?
Explain the importance of throwable class and its methods?
What is structure of java heap? What is perm gen space in heap?
Explain the transient field modifier?
Differentiate between nested and inner class in java.
How many threads can I run java?
Explain JMS in detail.
What is the string function?
What is class and its types?