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

What is the difference between static (class) method and instance method?

763


Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?

729


What does += mean in java?

751


What is a function argument in java?

725


What is difference between path and classpath in java?

678






Does list maintain insertion order java?

681


Why inputstreamreader is used in java?

742


If system.exit (0); is written at the end of the try block, will the finally block still execute?

804


What does bitwise or mean?

785


What does exp mean in math?

725


What is the use of pattern in java?

739


What is a byte string?

797


java program with complete 4 oops concepts implemented example

2909


What is double in java?

704


Should database connections be singleton?

737