wanye
01-21-2003, 02:39 PM
13. Write a java program that can display the following integers from 1 to 30 using a while loop and the counter variable x. Assume that the variable x has been declared but not initialized. Print only five integers per line. [Hint: Use the calculation x % 5. When the value of this is 0, print a newline character; otherwise, print a tab character. Assume this is an application–use the System.out.println() method to output the newline character and use the System.out.print( "\t" ) method to output the tab character.]
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
26 27 28 29 30
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
26 27 28 29 30