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 ? | 7 Yes | 0 No |
Post New Answer View All Answers
How do you invoke a method?
Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?
What is import java util arraylist?
Is java a digit method?
Does set allows null in java?
What is the byte range?
What is difference between adapter class and listener?
How can you write a loop indefinitely in java programming?
Explain runtime exceptions?
What is a java list?
What are the six ways to use this keyword?
What do you understand by the term wrapper classes?
Which class is used by server applications to obtain a port and listen for client requests?
What is remote method invocation (rmi)?
Can you pass by reference in java?