Program to print 1
1 2
1 2 3
1 2 3 4 like that
Answer Posted / rajesh
public class Triangle {
public static void main(String args[])
{
int i,j,k,sp=30;
for(i=1;i<=5;i++)
{
for(k=0;k<sp;k++)
{
System.out.print(" ");
}
sp=sp-1;
for(j=1;j<=i;j++)
{
System.out.print(" "+j);
}
System.out.println();
}
}
}
| Is This Answer Correct ? | 10 Yes | 1 No |
Post New Answer View All Answers
What lambda means?
What is the use of default method in interface in java?
please send me hr interview questions in it industry
Can a final method be overloaded?
Which is easier .net or java?
What is string data?
How many digits is int32?
What are the restrictions that are applied to the java static methods?
Is oracle charging for java?
What do you mean by thread safe?
How to make a non daemon thread as daemon?
Explain spliterator in java8?
What is the longest unicode character?
What is java and their uses?
What is a finally block?