Program to output as below formate:
1
2 3
4 5 6
7 8 9 10
Answer Posted / dhananjaya nawarathne
public class formatNumbers {
public static void main(String args[])
{
int k=1;
for(int i=1;i<5;i++)
{
for(int j=0;j<i;j++)
{
System.out.print(k++ + " ");
}
System.out.print("
");
}
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
When is an object subject to garbage collection?
What are the important features of Java 9 release?
What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?
Can static method access instance variables ?
What is a final class ?
Name some classes present in java.util.regex package.
What is an object in java and how is it created?
What is unicode full form?
What is a package in java? List down various advantages of packages.
Write a java program to generate fibonacci series ?
What is command line argument
What are the types of collections in java?
What is final variable?
Which browsers work with java?
What is lazy programming?