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


Please Help Members By Posting Answers For Below Questions

What is the largest number a double can hold?

568


Is alive method in java?

508


Why isn’t there operator overloading?

602


what is meant by encapsulation?

633


Is map ordered in java?

537






List any five features of java?

573


What is try-with-resources in java?

620


Is there any difference between nested classes and inner classes?

544


What is static in java?

561


How do you implement singleton class?

520


Can we extend singleton class?

535


What is exception handling in java?

578


What is a class in java?

582


why not override thread to make a runnable? : Java thread

561


How will you call an Applet using Java Script Function?

546