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
What is the difference between static (class) method and instance method?
Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?
What does += mean in java?
What is a function argument in java?
What is difference between path and classpath in java?
Does list maintain insertion order java?
Why inputstreamreader is used in java?
If system.exit (0); is written at the end of the try block, will the finally block still execute?
What does bitwise or mean?
What does exp mean in math?
What is the use of pattern in java?
What is a byte string?
java program with complete 4 oops concepts implemented example
What is double in java?
Should database connections be singleton?