Simple input in fundamental challenges

how to take inputs? the question says take a list of numbers , is this to be predefined

#include
using namespace std;

int main()
{
int a[]={1,2,88,-100,49};
int sum=0;
int i=0;

int s=sizeof(a)/sizeof(a[0]);

while (i<s)
{
    sum=sum+a[i];
    if(sum>=0)
    {
        cout<<a[i]<<endl;
        i++;
    }
    else
    {
        break;
    }
}

}

this is my take on the question, but on submitting no test case pass

Hi Ashish,
In this question you have to maintain a sum variable and take inputs and print them until the sum becomes negetive and donor print that input on which it become negetive.

Hey Ashish, there will be no predefined list which means you will never know number of element in the list.

Small hint: while(cin>>arr[i]) to take inputs, don’t forget to increment the value of i inside the while loop

hey Sanyam, if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.