Displaying some multiples Displaying Some Multiples
Write a program to calculate the multiples of a given number. Have the user enter a number, and then use a for loop to display all the multiples of that number from 1 to 12. It is not necessary to use a function.
You must use a for loop.
/*
 * Code by Clint &lt;https://github.com/clieg&gt;
 *
 *
 * Problem from: http://programmingbydoing.com/a/displaying-some-multiples.html
 */

import java.util.Scanner;

public class DisplayingSomeMultiples {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int number;

        System.out.print(&quot;Choose a number: &quot;);
        number = input.nextInt();

        System.out.println();

        for (int i = 1; i &lt;= 12; i++) {
            int mutiply = number * i;
            System.out.println(number + &quot; x &quot; + i + &quot; = &quot; + mutiply);
        }
    }
}
That looks quite good actually, minor stuff only.

for (int i = 1; i &lt;= 12; i++) {

I'm a persistent advocate for using &quot;real&quot; names for loop variables, like index or count or factor in this case.
        for (int factor = 1; factor &lt;= 12; factor++) {
            int result = number * factor;
            System.out.println(number + &quot; x &quot; + factor + &quot; = &quot; + result);
        }


        Scanner input = new Scanner(System.in);
        int number;

Do not declare all variables at the beginning of the method, declare them only when needed, that will limit the variable from creeping into scopes they don't belong in.

You could define the maximum factor as a constant.