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 do you mean by ternary operator in java?
What is the difference between jdk and jre?
What does += mean in java?
How do you use find and replace?
Difference between final and effectively final ?
Explain about narrowing conversion in java?
Can we override private method in java?
What is the function of compareto in java?
What are the two categories of data types in the java programming language?
What is charat java?
What if static is removed from main method?
What is the difference between public, private, protected, and friend access?
Define a package.
Give a brief description of java socket programming?
What modifiers are allowed for methods in an interface?