Challenge 3 Problem

When I submit the code it is saying compilation sucessfull but my points are still not increasing. In the submission section it is still showing wrong answer.
My code is:

Scanner scn = new Scanner(System.in);
	int n = scn.nextInt();
	int i, sum = 0;
	for (i = 0; i < n; i++) {
		int num = scn.nextInt();
		sum = sum + num;
		if (sum >= 0) {
			System.out.println(+num);
		}
		else {
			break;
		}
	}

hey @VinayakSingh11111 where is the N(No of inputs specified)?

Till when we need to take input??

Ans to the question is present in the question itself, as it said print the numbers till u get positive cumulative sum, so u need to take input till u got the positive cumulative irrespective of the number inputs.

  1. take infinite loop
  2. Add the new number to the previous sum.
  3. If the sum is positive print the current number.
  4. Otherwise, break the loop.

Question is still not clear.
It is saying the the list of the number is given and then we have to print till those number where the sum is not negative.
Do we need to use array in this question?

Do we need to use array in this question?
anwer : Nope
simple take infinite loop for input.

  1. Add the new number to the previous sum.
  2. If the sum is positive print the current number.
  3. Otherwise, break the loop.
    https://ide.codingblocks.com/s/251673
    you can see this