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
What is called module?
Where is the singleton class used?
What is string :: npos?
What are three types of loops in java?
What does java final mean?
How do I print a “?
What is anti pattern in cyber security?
what happens when a thread cannot acquire a lock on an object? : Java thread
Explain the private protected method modifier?
What is method in java ?
In Java list the methods that can be overridden?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
How many types of voids are there?
What is type inference in java8?
What advantage do java's layout managers provide over traditional windowing systems?