Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main ()
- {
- int N, S, I=0, v1, S2, temp;
- scanf ("%d%d", &N, &S);
- S2=S;
- while(I < N){
- scanf("%d", &v1);
- S2 += v1;
- if(S2<S){
- temp=S2;
- }
- if(S2>S){
- S=S2;
- }
- I++;
- }
- printf("%d\n", temp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement