Skip to content

Instantly share code, notes, and snippets.

@khatchad
Created March 23, 2015 19:38
Show Gist options
  • Save khatchad/e640e696b7aa3114e4c8 to your computer and use it in GitHub Desktop.
Save khatchad/e640e696b7aa3114e4c8 to your computer and use it in GitHub Desktop.
This program demonstrates the for loop.
/**
This program demonstrates the for loop.
*/
public class Squares
{
public static void main(String [] args)
{
int number; // Loop control variable
System.out.println("Number Number Squared");
System.out.println("-----------------------");
for (number = 1; number <= 10; number++)
{
System.out.println(number + "\t\t" +
number * number);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment