答案不会进入特定列

时间:2017-07-04 16:47:17

标签: java while-loop

答案正确无误。它们只是没有列分隔。 我需要它们在数字,2的倍数和10的倍数的不同列中。

    String head1 = "Number: ";
    String head2 = "Multiplied by 2: ";
    String head3 = "Multiplied by 10:  ";               
    int numberCounter;  // Numbers 0 through 10.
    int byTen;      // Stores the number multiplied by 10.
    int byTwo;          // Stores the number multiplied by 2.
    final int NUM_LOOPS = 10; // Constant used to control loop.

            // This is the work done in the housekeeping() method
    System.out.println("0 through 10 multiplied by 2 and by 10" + "\n");

    // This is the work done in the detailLoop() method
            System.out.print(head1);

            System.out.print(head2);

            System.out.print(head3 + "\n");



    // Initialize loop control variable.
    numberCounter = 0;
            while(numberCounter <= NUM_LOOPS){

                System.out.println(numberCounter);

                byTwo = numberCounter * 2;
                System.out.println(byTwo);

                byTen = numberCounter * 10;
                System.out.println(byTen);

                numberCounter++;
            }
    // Write your counter controlled while loop here
    // This is the work done in the endOfJob() method
            System.exit(0);
} // End of main() method.

0 个答案:

没有答案