Tell me the programme for this
@
1 2
@ @ @
1 2 3 4
Answer Posted / sachin
package abc;
public class Sachin {
int n=4;
public static void main(String... args){
Sachin s=new Sachin();
for (int i=0;i<s.n;i++){
if(i%2==0){
for(int a=0; a<i+1;a++){
System.out.print("@");
}
}else{
for(int a=0; a<i+1;a++){
System.out.print(a+1);
}
}
System.out.println();
}
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the 3 types of loops in java?
What is Java Package and which package is imported by default?
What are access specifiers available in java?
Write a method that will remove given character from the string?
What is a singleton class? Give a practical example of its usage.
How to use arraylist in java netbeans?
What is use of valueof () in java?
Why can't we override private static methods?
What are keywords in java?
Can an unreferenced object be referenced again?
What is bufferedwriter?
Define inheritance?
What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?
What is the difference in between cpp and java? Can u explain in detail?
Describe the various concepts related to object oriented programming (oop).