aboutsummaryrefslogtreecommitdiff
path: root/test/013_math_digitstosumzero/digitstosumzero_tests.c
blob: f28c02ae7ff3afacbb644cf8191a52ae001cb6d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "../test.h"

int64_t digitstosumzero(uint8_t *, uint8_t, uint8_t);

void run(void) {
	char str[STRLENMAX];
	uint8_t i, n, b, a[100];
	int64_t p;

	fgets(str, STRLENMAX, stdin);
	n = atoi(str);
	fgets(str, STRLENMAX, stdin);
	b = atoi(str);
	for (i = 0; i < n; i++) {
		fgets(str, STRLENMAX, stdin);
		a[i] = atoi(str);
	}

	p = digitstosumzero(a, n, b);
	printf("%" PRId64 "\n", p);
}

Generated with cgit - Back to sebastiano.tronto.net