Program to output as below formate:
1
2 3
4 5 6
7 8 9 10
Answer Posted / jyoti
public class format {
public static void main(String args[])
{
int k=1;
for(int i=0;i<5;i++)
{
for(int j=0;j<i;j++)
{
System.out.print(k++ + " ");
}
System.out.print("\n");
}
}
}
Is This Answer Correct ? | 15 Yes | 3 No |
Post New Answer View All Answers
Can final class have constructor?
List the different types of classloaders in java.
What is object english?
Is nullpointerexception checked or unchecked?
What is java abstraction with example?
Difference between static synchronization vs. Instance synchronization?
What are the advantages of java?
How do you add an element to an arraylist in java?
What’s meant by anonymous class?
What is diamond operator in java?
What is a package in java? List down various advantages of packages.
What is the difference between break and continue statements?
Does list allow duplicates in java?
What are access specifiers in java ?
when you will synchronize a piece of your code? : Java thread