I am trying to write a method that will calculate if two numbers are relatively simple to assign. I am primarily looking for answers on where to start. I know that there is a gcd() method that will do a lot for me, but the purpose pretty much forces me to do this without gcd or arrays.
I kind of started, because I know that I have to use the % operator in a for loop.
public static boolean relativeNumber(int input4, int input5){ for(int i = 1; i <= input4; i++)
Obviously, this method returns only true or false , because the main function will only print a specific line, depending on whether the two numbers are relatively prime or not.
I think I will probably have to write two for input4 , for both input5 and input5 , and maybe some if with the logical operand && , but I'm not sure
java primes relative
Tony
source share