repl.it
@FelishaMiranda/

Divisible Sum Pairs

C

No description

fork
loading
Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>

int main() {

  int a, b, c, i, j, k, n, counter=0;
  int arr[105];

  scanf("%d %d", &n, &a);
  getchar();

  for(i=0; i<n; i++){
    scanf("%d", &arr[i]);
    getchar();
  }

  for(i=0; i<n-1; i++){
    for(j=i+1; j<n; j++){
      if((arr[i]+arr[j])%a == 0){
        counter++;
      }
    }
  }

  printf("%d\n", counter);
  
}