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
Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?
How many types of equations are there?
What are extraneous variables examples?
Java Compiler is stored in JDK, JRE or JVM?
What is e in java?
How do you remove duplicates in java?
What is a protected void?
What exactly is a .class file?
What is anti pattern in cyber security?
Which collections are thread safe in java?
Define "Access specifiers" in java.
What is java virtual machine and how it is considered in context of java’s platform independent feature?
What is java objectoutputstream?
What is the use of conditional statement?
Why is multithreading important?