OK so what I want to do is create an infinite loop scanner that will add up all the values from the previously entered values which will then produce after each entered number the total value. How do I do this?
The following piece of code will result in a compile-time error: BigInteger c = a.nextBigInteger(); sum += c; If the intent is to add BigIntegers then `sum` should be a BigInteger too. Here's a fix: BigInteger sum = BigInteger.ZERO; // ... sum = sum.add(a.nextBigInteger()); // assume that 'a' has type … Read More
Edited by IIM
Edited by mvmalderen