1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Java Problem

  1. Nov 5, 2004 #1

    ek

    User Avatar

    Ok, I posted this in the software forum a this afternoon, but I guess all the java gurus are on vacation. So I thought I'd post it here. This is my problem:

    Ok, I have a new problem.

    This time I'm trying to make a program that prints all the prime factors of a given number and the 29 numbers one less than it. These numbers iare 432731 -> 432702.

    So here is my program:

    And here is the output:

    This is copied and pasted from the sample output, so the numbers are wrong, but it basically prints just the last number's prime factors, instead of all 30. Also, it prints it on the next line, because i used println, but if I use print then it all goes into a big mess.

    The output is supposed to look like this:

    So how do I make all 30 prime factorizations happen? I've been staring at this code for some time now and I can't figure it out.

    I know the for loop is screwed up because it isn't executing the whole statement and I know the contents of the while loop are screwed because I have two variables called the same name.

    Can somebody help me here? How do I go about fixing it?
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Java Problem
  1. Reflection problem (Replies: 1)

  2. Equilibrium Problems (Replies: 0)

  3. Magnet problem (Replies: 0)

  4. Optics problem (Replies: 0)

Loading...