can anybody explain with details how to calculate the factor of a number ? i m trying to do this with while statement. how can i do this ? please...

Recommended Answers

All 7 Replies

public void determineFactor(int sayi){
        int number = 1;
        int sayi1 = 1; 
        while (number <= sayi){ 
            number++;
            number = number * sayi1;  

        }//end while
    System.out.println(number); 
    }
}//end class


   ///and the value of sayi is defined as 5 in the driver class. 

What is your question?

can anybody explain with details how to calculate the factor of a number ? i m trying to do this with while statement. how can i do this ? please... ( i have already written this above. )

Try google. There are lots of different algorithms out there

i googled this, but i could not understand the logic of it. can you please explain it to me emphasizing its logic.

Post the algorithm you found and your questions about it.

Factors for 12: 1,2,3,4,6

And 12, but I would call them divisors.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.