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

Why runnable interface is used in java?

1198


Explain runtime exceptions?

1243


Why string is immutable with example?

1036


Can a method be overloaded based on different return type but same argument type?

1019


Can we have more than one package statement in the source file?

1114


What is jrmp?

1009


What is boolean in java?

1030


What state does a thread enter when it terminates its processing in java programming?

1089


What is the difference between declaration and definition in java?

1158


What is oop principle in java?

1267


what are the high-level thread states? : Java thread

1073


What is illegal identifier in java?

1077


What exactly is java?

1001


Can a class with private constructor be extended?

1004


Define inheritance?

1076