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...

Hi friends i want display Triangle shap stars(*) please can
tell me any one java code logic?
*
***
*****
******* Like this

Answer Posted / sadikhasan palsaniya

public class Test{
public static void main(String var[]){
int c=1;
for(int i=1;i<=4;i++){
for(int k=4;k>=i;k--)
System.out.print(" ");
for(int j=1;j<=c;j++){
System.out.print("*");
}
System.out.println("");
c=c+2;
}
}
}

Is This Answer Correct ?    14 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we overload the constructors?

930


Explain about exception propagation?

977


Why is inheritance used in java?

1062


Can static methods access instance variables in java?

1024


What is the major difference between linkedlist and arraylist?

965


What is annotation in java?

999


Can we use different return types for methods when overridden?

942


How will you compute size of a structure?

1076


Explain restrictions on using enum?

1014


Is java util regex pattern thread safe?

973


Why java strings are immutable in nature?

981


what is object-oriented programming in java?

1000


Is array dynamic in java?

877


What is a pattern what is an anti pattern?

894


Can a final variable be manipulated in java?

934