Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

When is an object subject to garbage collection?

991


What are the important features of Java 9 release?

949


What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?

1070


Can static method access instance variables ?

1071


What is a final class ?

1079


Name some classes present in java.util.regex package.

980


What is an object in java and how is it created?

1003


What is unicode full form?

929


What is a package in java? List down various advantages of packages.

1195


Write a java program to generate fibonacci series ?

1019


What is command line argument

1151


What are the types of collections in java?

1001


What is final variable?

878


Which browsers work with java?

1020


What is lazy programming?

960