Use two counter in for loop - Java Language Basics

Java examples for Language Basics:for

Description

Use two counter in for loop

Demo Code

public class CountBothWays
{
     public static void main(String[] args)
      {//from   www . j a  va2  s. c o  m
           int a, b;
           for (a = 1, b = 10; a <= 10; a++, b--)
                System.out.println(a + " " + b);
      }

}

Related Tutorials