Question: The task here is to complete the main method inside the class SumOfTriangles. The method should read ints from the user, compute their triangle (
The task here is to complete the main method inside the class SumOfTriangles. The method should read ints from the user, compute their "triangle" see below and add the "triangles" together until any negative number is entered. The method should then print out the sum of the triangles of all the nonnegative integers entered followed by a newline If there are no nonnegative integers before the first negative integer, the result should be
The triangle of a positive integer nn is nnnn Note that the numerator is always even, so you can safely do integer division.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
