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
Does every java program need a main?
What are unchecked exceptions in java?
Is java owned by oracle?
What is finalize() function in java?
Can java object be locked down for exclusive use by a given thread?
In java, how we can disallow serialization of variables?
What is the final access modifier in java?
Explain the difference between call by refrence and call by value?
What is main difference between variable and constant?
What is ellipsis in java?
Write a program in java to create a doubly linked list containing n nodes.
How do you decide when to use arraylist and linkedlist?
How to check if linked list contains loop in java?
What are the differences between processes and threads?
Why do we use bufferedreader?