Program to print 1
1 2
1 2 3
1 2 3 4 like that
Answer Posted / ravi jain
public class Test
{
public static void main(String[] args)
{
int sp=5;
for(int n=1;n<=5;n++)
{
for(int s=1;s<=sp;s++)
{
System.out.print(" ");
}
for(int i=1; i<=n;i++)
{
System.out.print(i+" ");
}
System.out.println();
sp--;
}
}
}
| Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
What is final int?
How to sort an array from smallest to largest java?
What are the three parts of a lambda expression?
Is namespace same as package in java?
Can we assign the reference to this variable?
Difference between ‘is-a’ and ‘has-a’ relationship in java?
What is string pool?
Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?
What is an object's lock and which object's have locks in java programming?
Is java based on c?
What is a war file?
Why java is platform independent? Explain.
What is append function?
What about interthread communication and how it takes place in java?
What is use of arraylist in java?