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
In Java list the methods that can be overridden?
What is a concrete classes? Is Java object class is concrete class?
What is the difference between stored procedure & function?
What are the main uses of the super keyword?
What is the maximum size of hashmap in java?
What is http client in java?
What do you mean by composition in java?
Why does java does not support multiple inheritance? Explain
What is the difference between multitasking and multithreading in Java
What design pattern you have used in your project? I answered Factory pattern, how it is implemented? What are its advantage? Do know about Abstract Factory?
What is void class in java?
Why we use methods in java?
what are three ways in which a thread can enter the waiting state? : Java thread
What is the program compilation process?
What is r * in math?