Simple input question doubt

In this question how will i know how many integers i need to enter,should i give the number of integers also as input?

while(cin>>a && sum>0){
//code
}
you can do it like this ,it worked for me

hey soumya, use only while(cin>>N) and store them in array than find the numbers from this array that gives sum less than zero