pages:
  • 1
AR.Fereydouni SAYS

My code Is here:

//In the Name of Allah

import java.util.Scanner;

public class P6003 { private static boolean isReletivePrime(int a, int b) { for(int c;(a%b) != 0;b = (b%a)) { c = b; b = a; a = c; } if (b == 1) return true; else return false; } private static int numPairsFinder(int p, int q) { int res = 0, tmp = (q / p); int sqrt = (int)(Math.sqrt(tmp)); for (int i = 1; i <= tmp; i++) { if ((tmp % i) == 0) if (isReletivePrime(i,(tmp/i))) res++; } return res; }

public static void main(String[] args) {
    Scanner in_kb = new Scanner(System.in);
    do {
        int p = in_kb.nextInt(), q = in_kb.nextInt();
        System.out.print(numPairsFinder(p,q) + "\n");
    } while (in_kb.hasNextInt());
}

}

can anyone tell me what is wrong with this code?

please don't correct the code just tell the point briefly. I want to code and solve the question my self

Thanks!

Best Regards!

AMiR SAYS

Please please please, learn how to post your codes in discussion!

Do not just copy/paste your codes here! you must hit a tab before each line of your code!