Day 1: Add C solution part 1
This commit is contained in:
parent
ff394a0c23
commit
eb2817eec9
2 changed files with 15 additions and 0 deletions
1
01/input.h
Normal file
1
01/input.h
Normal file
File diff suppressed because one or more lines are too long
14
01/solution.c
Normal file
14
01/solution.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "input.h"
|
||||
|
||||
int main(void) {
|
||||
uint16_t answer = 0;
|
||||
for (uint16_t *p = input+1; p < (&input)[1]; p++) {
|
||||
if (*p > *(p-1))
|
||||
answer++;
|
||||
}
|
||||
|
||||
printf("Answer: %d\n", answer);
|
||||
}
|
Loading…
Reference in a new issue