Program to print 1
1 2
1 2 3
1 2 3 4 like that

Answer Posted / sunil pradhan

public class program1 {

public static void main(String[] args){

for(int i = 1; i<=5 ;i++){

for(int k = 1; k<=i; k++){

System.out.print(k);
}
System.out.println("\n");
}

}

}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a flag variable?

557


Difference between comparator and comparable in java?

615


What is n in java?

536


Why convert an applet to an application?

615


Explain about object oriented programming and its features?

596






What is run time allocation?

576


Can a class extends itself in java?

527


Explain java heap space and garbage collection?

583


Write a program in java to find the maximum and minimum value node from a circular linked list.

519


How finally used under exception handling?

515


What do you mean by local class?

514


How variables are declared?

517


How many types of interfaces are there?

576


How to sort array of 0 and 1 in java?

541


Can we have try without catch block?

642