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
How can a gui component handle its own events in java programming?
Explain the private protected method modifier?
What is a newline character in java?
When do I need to use reflection feature in java?
what is the difference between future and callable interface in java?
Does java isempty check for null?
How to optimize the javac output?
How many types of memory areas are allocated by jvm?
What is meant by overloading?
Does apple use java?
Why do we need variables?
What is cr keyboard?
How do you compare two strings lexicographically?
What is variable in java?
Can a class with private constructor be extended?