part one day one
This commit is contained in:
commit
1e57445312
26
01/main.c
Normal file
26
01/main.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int prev = -1;
|
||||
int total = 0;
|
||||
|
||||
static char buffer[1024];
|
||||
FILE *f = fopen("input", "r");
|
||||
|
||||
while(fgets(buffer, 1024, f)) {
|
||||
int val = atoi(buffer);
|
||||
if(prev != -1 && val > prev) {
|
||||
total++;
|
||||
}
|
||||
prev = val;
|
||||
}
|
||||
|
||||
printf("total increasing: %d\n", total);
|
||||
|
||||
fclose(f);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user