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 print 1
1 2
1 2 3
1 2 3 4 like that

Answer Posted / rajesh

public class Triangle {

public static void main(String args[])
{
int i,j,k,sp=30;
for(i=1;i<=5;i++)
{
for(k=0;k<sp;k++)
{
System.out.print(" ");
}
sp=sp-1;
for(j=1;j<=i;j++)
{
System.out.print(" "+j);
}
System.out.println();
}
}

}

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to compare various strings with the help of == operator? What are the risks involved?

1067


What is the use of static class?

1186


Do I need to import java.lang package any time? Why?

1387


What is the largest long allowed by java?

1064


How can you set an applet’s height and width as a percentage?

928


Can we create our own wrapper class in java?

966


Is java a software?

950


What do u mean by variable?

1049


Does garbage collection occur in permanent generation space in jvm?

1085


Why parsing is done?

978


explain copyonwritearraylist and when do we use copyonwritearraylist?

947


Does java support multiple inheritances?

1020


What is the history of java?

990


Is object a data type in java?

1107


How can we find the actual size of an object on the heap?

1314