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
Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?
What are the different data types in java?
What is bigger kb or mb?
What is the need of transient variables in Java ?
What is treeset in java collection?
Explain about core java?
If goto and const is reserve words than why it is not work in java?
What is the purpose of java?
When object is created and destroyed?
Why packages are used?
Explain wrapper classes in java?
Is java based on c?
What is meant by string is immutable?
What is java basic concept?
What is the name of the java compiler?