Connecting Tech Pros Worldwide Help | Site Map

java program

Newbie
 
Join Date: Jun 2007
Posts: 1
#1: Jun 30 '07
please tell me how to write a java program to find factors of given number
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Jun 30 '07

re: java program


Quote:

Originally Posted by hdevi

please tell me how to write a java program to find factors of given number

Do you know what the '%' (modulo) operator does? Its result is the remainder
r of its operands n and d such that n= (n/d)*d+r, e.g. 7%3 == 1 and 12%5 == 2.
You'll need that operator if you want to find divisors d of a number n because
n%d will be equal to zero then.

kind regards,

Jos
jeffbroodwar's Avatar
Member
 
Join Date: Oct 2006
Posts: 118
#3: Jul 2 '07

re: java program


Hi,

Please write a sample code / snippet that will show this program. From that code we might be able to help... ok? try the modulus operator that jos told you.

Best Regards,
Jeff
Reply