Use nested loops and the code from Lab Project 21 (a childish sum) to produce the output below. The outer loop control variable can be used to help display the output the inner loop. 30 The sum of positive integers from 1 to 1 is 1 The sum of positive integers from 1 to 2 is 3 The sum of positive integers from 1 to 3 is 6 The sum of positive integers from 1 to 4 is 10 The sum of positive integers from 1 to 5 is 15 output for integers 16 to 99. The sum of positive integers from 1 to 100 is 5050 Because we already have a program that computes 1+2+-+n for any positive integer n, we can embed that code in a second auter loop that loops 100 times. The outer loop control variable can be used to control the number of times we loop and more importantly, it can be used to control the upper limit of the inner computation
Use nested loops and the code from Lab Project 21 (a childish sum) to produce the output below. The outer loop control variable can be used to help display the output the inner loop. 30 The sum of positive integers from 1 to 1 is 1 The sum of positive integers from 1 to 2 is 3 The sum of positive integers from 1 to 3 is 6 The sum of positive integers from 1 to 4 is 10 The sum of positive integers from 1 to 5 is 15 output for integers 16 to 99. The sum of positive integers from 1 to 100 is 5050 Because we already have a program that computes 1+2+-+n for any positive integer n, we can embed that code in a second auter loop that loops 100 times. The outer loop control variable can be used to control the number of times we loop and more importantly, it can be used to control the upper limit of the inner computation
![- CPS150 GaussLab2.java
Open with -
import java.util.Scanner;
* CPS150 GaussLab2.java
** /
★ CPS 150
* Algorithms & Programming I
* Lab Project: Multiple Gauss Sums
@author *** Replace with your name
***
public class. CPS150 GaussLab2
}
public static void main (String[] args)
// Use nested loops to compute and output
the Gaus S sum for each value from 1 to 100.
//
} // end main method
} // end class CPS150 GaussLab2
ENG
3
N
-D
F5
四
23
%24](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F44ae875a-f598-455b-b111-f9246b312123%2F19109661-ca1e-4b9d-916a-8be65d22b18d%2F9js4ji9.jpeg&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images









