【发布时间】:2021-06-14 09:48:29
【问题描述】:
编写一个从 5 到 500(包括 5 到 500)按 5 计数的应用程序,并且 在每 50 的倍数(50、100、150 等)之后开始一个新行。
如何移动到新行以打印 50 的倍数?
package loop2;
/**
*
* @author whitneykenny
*/
public class Loop2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int i = 5;
while (i <=500) {
System.out.print(i + " ");
i = i + 5 ;
}
}
}
【问题讨论】: