Skip to content

Instantly share code, notes, and snippets.

@annibuliful
Created October 29, 2017 17:23
Show Gist options
  • Save annibuliful/fbdb19086e8ac4b945f41d3c0fbcf898 to your computer and use it in GitHub Desktop.
Save annibuliful/fbdb19086e8ac4b945f41d3c0fbcf898 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
int dimension, dimensionOfN, divisible,
i, j, k, temp, count = 0;
printf("Input number of dimension and K value:");
scanf("%d %d", & dimension, & divisible);
dimensionOfN = dimension * dimension;
int arr[dimensionOfN];
for (i = 0; i < dimensionOfN; i++) {
printf("Input number %d : ", i + 1);
scanf("%d", & arr[dimensionOfN]);
}
for (int i = 0; i < dimensionOfN-2; i++)
{
for (int j = i+1; j < dimensionOfN-1; j++)
{
for (int k = j+1; k < dimensionOfN; k++)
{
temp = arr[i] + arr[j] + arr[k];
if (temp % divisible == 0)
{
printf("DUMMY\n");
count += 1 ;
}
}
}
}
printf("count: %d\n" , count);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment