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 basic syntax?
Can a string be null?
Why stringbuilder is not thread safe in java?
Explain listiterator and methods in listiterator?
Explain about procedural programming language or structured programming language and its features?
Can we make main() thread as daemon?
How do I start learning java?
Is java ee a framework?
Have you ever used hashtable and dictionary?
What is a copy constructor in java?
Is java a prime method?
Is empty .java file name a valid source file name?
What invokes a thread's run() method in java programming?
What is jar?
What is a function easy definition?