Tell me the programme for this
@
1 2
@ @ @
1 2 3 4
Answer Posted / thati.donthi
public class PrintTriangle {
public static void main(String[] args) {
int n=4;
for(int i=1;i<=n;i++) {
for(int j=0;j<2*n-i;j++) {
System.out.print(" ");
}
for(int j=1;j<=i;j++) {
if(i%2 != 0) {
System.out.print("@"+" ");
} else {
System.out.print(j+" ");
}
}
System.out.println();
}
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is arrays fill in java?
When parseint method can be used?
What is primitive data type in java?
What is stack explain?
What is an empty class? What functionality does it offer in Java?
Can we overload destructor in java?
What is the name of the java compiler?
What is binary tree in java?
What language is java written?
What is the SimpleTimeZone class?
What are the different types of data structures in java?
When should you make a function static?
Is empty in java?
How do you convert an int to a double in java?
How do you escape in java?