Search:

Type: Posts; User: javapenguin

Search: Search took 0.09 seconds.

  1. Replies
    13
    Views
    1,789

    Re: help factor

    By any chance are you saying that it should be,
    if (x% i ==0)

    ?
  2. Replies
    13
    Views
    1,789

    Re: help factor

    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[]...
  3. Replies
    13
    Views
    1,789

    Re: help factor

    ~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.
    ...
  4. Replies
    13
    Views
    1,789

    Re: help factor

    public class Factor {

    public static void main(String[] args){
    Scanner input=new Scanner (System.in);

    String yn;
    int number;
    int current;
    String output = "";
    ...
  5. Replies
    13
    Views
    1,789

    Re: help factor

    120 % 2= 0;

    output = "2 "
    120/2 = 60;

    number = 60;

    60%2 = 0;
    output = "2 2 "
  6. Replies
    13
    Views
    1,789

    Re: help factor

    output += 2 +" ";

    Will only output 2
  7. Replies
    13
    Views
    1,789

    Re: help factor

    x%2 is either 0 or 1.
Results 1 to 7 of 7