[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.
-
Edited by Neanderthal 487: 2/20/2013 2:05:29 AMYou could just use two print statements, one for the text, the other for the ints. Remove "The factors are" from the loop and print it individually.