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
What is nan in java?
Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.
What are the differences between getting and load method?
who can i handle multiple client in RMI
How does a cookie work in Servlets?
What is queue in java?
How do you convert bytes to character in java?
Can a class have multiple subclasses?
Can we write method inside a method in java?
Can we write class inside a class in java?
How many characters is 16 bytes?
Can we have multiple catch block for a try block?
Explain the concept of hashtables?
explain multi-threading in java?
What is boolean data type in java?