Easy | JAVA | Simple
\n# Code\n\nclass Solution {\n    public int countPairs(int[] nums, int k) \n    {\n        int count=0;\n        for(int i=0; i<nums.length; i++)\n        {\n 
\n# Code\n```\nclass Solution {\n    public int countPairs(int[] nums, int k) \n    {\n        int count=0;\n        for(int i=0; i<nums.length; i++)\n        {\n            for(int j=i+1; j<nums.length; j++)\n            {\n                if(nums[i]==nums[j])\n                {\n                    if((i*j)%k==0)\n                    {\n                        count++;\n                    }\n                }\n            }\n        }\n        return count;\n    }\n}\n```
['Java']