Hi friends i want display Triangle shap stars(*) please can
tell me any one java code logic?
*
***
*****
******* Like this
Answers were Sorted based on User's Feedback
Answer / 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 |
How do listeners work?
Distinguish between a predicate and a function?
What is a class object?
What is the purpose of a default constructor?
Explain the private protected method modifier?
What is the relationship between clipping and repainting under awt?
What is literal example?
How does compareto method work?
Why is prepared Statement, Callable Statement used for? What is the need of Batch updates?
What about main() method in java ?
What is the difference between compiler and jvm?
What is a boolean used for?