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 |
What is a parent class in java?
Tell us something about different types of casting?
By what default value is an object reference declared as an instance variable?
What is Locale class?
What is null mean in java?
What is stringbuffer in java?
How Vector class is synchronized,How to build user defined class as synchronized?
What is adapter class?
Is there any sort function in java?
What is a ternary operator in java? What is an interface?
Are static members inherited to sub classes?
What Is Resource Leak?