Created
October 29, 2017 17:23
-
-
Save annibuliful/fbdb19086e8ac4b945f41d3c0fbcf898 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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