July 05, 2012

Write program following output in console (in java)?


Output:
1
12
123
1234
12345

Program:

public class ForTest {
public static void main(String[] args) {
for(int i=1;i<6;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(j);
}
System.out.println();
}
}
}

1 comment:

  1. Want to prepare for IT job . Prepare the interview questions now at very easy way.

    For interview preparation on Java Refer http://www.javatrainings.in
    And Dot net Interview and Trainings Refer http://www.dotnettrainings.in
    For linux interview questions Refer http://www.linuxtrainings.in
    For ccna interview questions Refer http://www.ccnatrainings.in
    For ccnp interview questions Refer http://www.ccnptrainings.in

    ReplyDelete

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

My Favorite Site's List

#update below script more than 500 posts