advent-of-code/2018/01/day1.c

18 lines
287 B
C
Raw Permalink Normal View History

2018-12-01 17:53:35 +01:00
#include <stdio.h>
#include <stdlib.h>
int main() {
int position = 0;
FILE* inputFile = fopen("input", "r");
char line [10];
while (fgets(line, sizeof(line), inputFile)) {
position += strtol(line, NULL, 10);
}
printf("%d", position);
return 0;
}