Respuesta :
Using the knowledge of computational language in C++ it is possible to write a code that given an array of integers a, your task is to count the number of pairs i and j.
Writting the code:
// C++ program for the above approach
#include <bits/stdc++.h>
using namespace std;
// Function to find the count required pairs
void getPairs(int arr[], int N, int K)
{
// Stores count of pairs
int count = 0;
// Traverse the array
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
// Check if the condition
// is satisfied or not
if (arr[i] > K * arr[j])
count++;
}
}
cout << count;
}
// Driver Code
int main()
{
int arr[] = { 5, 6, 2, 5 };
int N = sizeof(arr) / sizeof(arr[0]);
int K = 2;
// Function Call
getPairs(arr, N, K);
return 0;
}
See more about C++ code at brainly.com/question/17544466
#SPJ4