JavaScript is required to use Bungie.net

服务提示
明日《命运2》将暂时下线以进行定期维护。点击此处查看最新的命运服务器和更新状态。

离题

浏览大量随机讨论。
2/20/2013 1:22:02 AM
4

Help with a simple Computer Science program.

[quote]import java.util.Scanner; public class Project4 { public static void main (String[] args) { int count; int i = 0; Scanner scan = new Scanner(System.in); System.out.print (" Please input a number to be shown the factors: "); count = scan.nextInt(); do{ i++; if(count%i == 0) System.out.println("The factors are: " + i); }while(i <= count); } }[/quote] That is my program and I just need someone to explain how to make all the solutions show up on one line without reiterating the "The factors are" line multiple times. Thanks.

发贴语言:

 

遵守游戏礼仪。发送贴子前请花点时间阅读我们的行为准则 取消 编辑 创建火力战队 贴子

你没有权限查看此内容。
;
preload icon
preload icon
preload icon