Advertisement
Guest User

3628

a guest
Mar 30th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.     int N;
  5.     int diff = 0;
  6.     int max = 0;
  7.     int T = 1001;
  8.     int count = 0;
  9.     do {
  10.         scanf("%d", &N);
  11.         if(N != 0)
  12.             count++;
  13.         if(N > T)
  14.             diff = diff + N - T;
  15.         else
  16.             if(diff > max) {
  17.                 max = diff;
  18.                 diff = 0;
  19.             }
  20.         T = N;
  21.     } while(N != 0)
  22.     printf("Recieved %d numbers\nThe biggest difference: %d", count, max);
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement