Finding pair of numbers whose sum divides the product

To find the number of pairs (a,b) within a given range N, such that the sum of the two numbers a and b divides the product of the two numbers a and b.



Implementation:

#include <stdio.h>
int main()
{
      int t,cnt,N,i,j;
      scanf("%d",&t);
      while(t--)
      {
           cnt=0;
           scanf("%d",&N);
           for(i=1;i<=N;i++)
           {
                for(j=i+1;j<=N;j++)
                {
                     if((i*j)%(i+j)==0)
                     cnt++;
                }
           }
           printf("%d\n",cnt);
      }
      return 0;
}


Input:

The first line - T, number of test cases
Followed by T lines, Each line - upper limit of range (N)
Output:
The number of such pairs.
2
0
In the second test case required pairs are (3, 6), (4, 12), (6, 12) and (10, 15).

Sample Input

2

15

Sample Output

4