Skip to content

Commit

Permalink
Create program.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
saksham101 authored Jun 28, 2021
1 parent c90501f commit a33c1f9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions program.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<bits/stdc++.h>
using namespace std;
int getPairsCount(int arr[], int n, int num)
{
int count = 0;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
if ((arr[i] + arr[j]) % num == 0)
count++;
return count;
}
int main() {
int T;
cin>>T;
while(T>0){
int size;
cin>>size;
int arr[size];
for(int i=0; i<size; i++){
cin>>arr[i];
}
int num = 4;
cout<<getPairsCount(arr, size, num);
if(T!=1){
cout<<"\n";
}
T--;
}
return 0;
}

0 comments on commit a33c1f9

Please sign in to comment.