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

What is unicode used for?

1165


Can we pass null as argument in java?

952


In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?

1323


What restrictions are placed on method overloading in java programming?

1051


What is a java predicate?

966


what are synchronized methods and synchronized statements? : Java thread

997


What is the flag in java?

1063


What is byte data type?

1001


Is null a value?

1040


What are internal and external variables?

957


What are the main uses of this keyword?

1065


What are the kinds of polymorphism?

1092


List implementations of list interface?

1036


Can we extend immutable class?

990


How does arrays sort work in java?

1009