Advertisement
Guest User

vovo.c

a guest
May 16th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5. int N, S, I=0, v1, S2, temp;
  6. scanf ("%d%d", &N, &S);
  7. S2=S;
  8. while(I < N){
  9. scanf("%d", &v1);
  10. S2 += v1;
  11. if(S2<S){
  12. temp=S2;
  13. }
  14. if(S2>S){
  15. S=S2;
  16. }
  17. I++;
  18. }
  19. printf("%d\n", temp);
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement