By any chance are you saying that it should be,
if (x% i ==0)
?
Type: Posts; User: javapenguin
By any chance are you saying that it should be,
if (x% i ==0)
?
I found that the code won't work for times when it involves perfect squares, cubes, fourths, etc.
import java.util.Scanner;
public class Factor {
public static void main(String[]...
~X(#-o#-o#-o#-o#-o#-o#-o#-o#-o
It appears that my while loops, while letting you repeat, don't clear the value in output.
Also, your code may not work for 121.
It appears to work for 120.
...
public class Factor {
public static void main(String[] args){
Scanner input=new Scanner (System.in);
String yn;
int number;
int current;
String output = "";
...
120 % 2= 0;
output = "2 "
120/2 = 60;
number = 60;
60%2 = 0;
output = "2 2 "
output += 2 +" ";
Will only output 2
x%2 is either 0 or 1.