Hi. Please take a look at my code. How can I count how many times someone add a number before someone hits - 1? Do you have any hints for me here?
public class Solution {
public static void main(String[] args) throws Exception {
Scanner sc1 = new Scanner(System.in);
int x;
while (true) {
x = sc1.nextInt();
count ++;
if (x==-1)
break;
}
}
}