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 are the two categories of data types in the java programming language?
What is listnode in java?
What are some alternatives to inheritance?
What does provide mean construction?
Explain different types of thread priorities ?
What is canonical name in java?
Explain the difference between call by refrence and call by value?
What is the function of http?
How many ways can an argument be passed to a subroutine and explain them?
Why do we use threads in java?
Detail discussions on JVM, memory management and garbage collector.
How is the marker interface used in Java?
What is lastindexof in java?
How do you stop a thread in java?
What is Session reduplication and how its done?