Tell me the programme for this


@
1 2
@ @ @
1 2 3 4

Answer Posted / varun

public class HelloWorld{

public static void main(String []args){
int k=1;
for(int i=0;i<4;i++)
{
for(int j=0;j<=i;j++)
{
if(i%2==0)
System.out.print("@");
else
System.out.print(++k);
}
System.out.println();
k=0;
}
}
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is bool mean?

575


Explain the difference between extends thread vs implements runnable in java?

542


Which object oriented concept is achieved by using overloading and overriding?

560


Difference between nested and inner classes ?

610


Explain serialization and deserialization in java?

558






What is a numeric format?

574


How do you override a method in java?

539


How do you pass by reference?

539


Can java inner class be static?

562


Is there any difference between nested classes and inner classes?

544


What is e java?

561


What are extraneous variables examples?

533


What is the difference between a field variable and a local variable?

577


What is logical variable?

518


Where is core java used?

588