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

How hashset works internally in java?

1065


What is local variable and instance variable?

1039


What is the main function in java?

1051


What is the difference between heap and stack memory?

1182


Explain about fail fast iterators in java?

1041


Can we inherit a class with private constructor?

1100


Tell me the Importent classes in net package?

1984


How do you clear an arraylist in java?

965


What are different types of arrays?

1004


Which methods are used during serialization and deserialization process?

979


Can we use different return types for methods when overridden?

978


What are encapsulation, inheritance and polymorphism?

990


Is boolean a wrapper class in java?

1041


What is definition and declaration?

998


What are selection structures?

977