Displaying ./code/sternflCode/p6.c#include<stdio.h>
int main() {
FILE *f = fopen("small", "r");
int c;
int p1;
int p2;
int count=0;
fscanf(f,"%d",&p2);
fscanf(f,"%d",&p1);
while ( 1==fscanf(f, "%d", &c) ) {
if (c>p1+p2)
count++;
p2=p1;
p1=c;
}
printf("%d\n", count);
}
|