#include <stdio.h> #include <math.h> void main(void) { FILE *in, *out; int N, K[100], i, j, first, second, max; if ((in = fopen("INPUT.TXT", "rt")) == NULL) { fprintf(stderr, "Cannot open input file.\n"); return; } fscanf(in, "%d", &N); for(i = 0; i < N; i++) fscanf(in, "%d", &K[i]); fclose(in); for(max = -1, i = 0; i < N-1; i++) for(j = i + 1; j < N; j++) if (max < abs(K[i] - K[j])) { max = abs(K[i] - K[j]); first = i; second = j; } if ((out = fopen("OUTPUT.TXT", "wt")) == NULL) { fprintf(stderr, "Cannot open output file.\n"); return; } fprintf(out, "%d %d", K[first], K[second]); fclose(out); }