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
Which collection is ordered in java?
What is pass by value?
What is java reflection api?
What is an infinite loop? How infinite loop is declared?
What does function identity () do?
What ide should I use for java?
What does snprintf return?
Is 0 a real number?
What are the three parts of a lambda expression?
How do you represent a space in regex java?
What are the benefits of operations in java?
Are the imports checked for validity at compile time? Will the code containing an import such as java.lang.abcd compile?
What is yield () in java?
What is boolean query?
How does the java compiler work?