1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <stdlib.h> #include <stdio.h> int main(void) { char buff[80]; int last = -1; int count = 0; while(fgets(buff, sizeof buff, stdin)) { int i = atoi(buff); if (last != -1 && last < i) { printf("%d\n", i); count++; } last = i; } printf("count=%d\n", count); return 0; }