Question: Wissen Technology Recently asked Online Assessment Question (26th September 2023) | Count pairs
0
Entering edit mode

0
Entering edit mode

#include<iostream>

using namespace std;

 

int find(int arr[],int x,int n)

{

    int sum=0;

    for(int i=0;i<n;i++)

        for (int j=i+1;j<n;j++)

        {

            if(arr[i]==arr[j] && (i+1)*(j+1)%x==0)

                sum++;

        }

    return sum;

}

int main()

{

    int arr[3]={2,2,2};

    int x=2;

    cout<<find(arr,x,3);

    return 0;

}

ADD COMMENTlink 4 months ago Ayush Tolani • 0

Login before adding your answer.

Similar Posts
Loading Similar Posts