can someone describe this problem?
I did not understand this problem?
should i take all the input all at once or go in loop and correspondingly take input till sum becomes negative and stop output?

i am using this code in c
#include<stdio.h>
int main(void) {
int no,n,sum=0;
scanf("%d",&n);
for (int i=1;i<=n;i++){
scanf("%d",&no);
if(no>=-1000 && no<=1000){
sum+=no;
if(sum>=0)
printf("%d\n",no);
else
break;
}
else{
printf("Enter number bewteen -1000 and 1000");
}
}
return 0;
}
#include<stdio.h>
int main(void) {
int no,sum=0;
for (int i=1;i>0;i++){
scanf("%d",&no);
if(no>=-1000 && no<=1000){
sum+=no;
if(sum>=0)
printf("%d\n",no);
else
break;
}
else{
printf("Enter number bewteen -1000 and 1000");
}
}
return 0;
}
// i changed the code and go on for infinite number of inputs
this worked
thank you
pls dont forget to mark it resolve
