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
Are arrays passed by reference in java?
Difference between final and effectively final ?
What are the rules for naming an array?
What is scope & storage allocation of global and extern variables? Explain with an example
What is mutable object and immutable object?
What is a type parameter in java?
What is singletonlist in java?
Can a string be null?
What is classname class in java?
If a method is declared as protected, where may the method be accessed in java programming?
What is maximum size of arraylist in java?
Can constructor be synchronized?
What is the method to declare member of a class static?
Difference between comparator and comparable in java?
What is private static in java?