Tell me the programme for this
@
1 2
@ @ @
1 2 3 4
Answer Posted / chantiraji
public class TriangleDisplay {
public static void main(String[] args) {
int n = 4;
for (int i = 1; i <= n; i++) {
for (int j = 4; 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 ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is use of static in java?
What is Java Annotations?
Explain about assignment statement?
What is multiple inheritance? Is it supported by java?
What is unicode full form?
What is the difference between private & public & friendly classes?
What are keywords in programming?
How big is a boolean?
What is the set interface in java programming?
Can we assign the reference to this variable?
Why isn’t there operator overloading?
Why scanner is used in java?
How many ways can we create the string object?
Explain what is encapsulation?
How many static init can you have?