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

Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?

1072


What are the different data types in java?

1052


What is bigger kb or mb?

1112


What is the need of transient variables in Java ?

1116


What is treeset in java collection?

1013


Explain about core java?

1199


If goto and const is reserve words than why it is not work in java?

2027


What is the purpose of java?

1055


When object is created and destroyed?

1145


Why packages are used?

1688


Explain wrapper classes in java?

1061


Is java based on c?

1050


What is meant by string is immutable?

1159


What is java basic concept?

1093


What is the name of the java compiler?

1097