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
I am unable to find or learn about print command. I have a graphical program in core java in applet but i want to give print command but i have coding for that so if anyone know about this plz mail me on avdhesh_chauhan007@yahoo.co.in
What is instance example?
What state is a thread in when it is executing?
What is the difference between Error, defect,fault, failure and mistake?
Explain the meaning of java applet.
Is 0 a real number?
In Java list the methods that can be overridden?
How to sort an array in java without using sort method?
What is 32 bit float?
What is the benefit of using enum to declare a constant?
What is the difference between abstract classes and interfaces?
What is set string?
What is private static class in java?
Print Vertical traversal of a Binary Tree.
What is mutable object and immutable object?