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 the difference between equals() and?
What do you understand by the term polymorphism?
What is basic syntax?
Explain the hierarchy of java exception classes?
Java.util.regex consists of which classes?
If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?
Is java ee a framework?
What is the use of callablestatement?
In how many ways we can create threads in java?
What do you mean by synchronized non access modifier?
What is meant by method overriding?
Can we make constructors static?
What is the difference between a checked and an unchecked exception?
explain the concept of virtual method invocation in polymorphism in detail?
How many types of array are there?