Define the following method: public static void Series(intn) This method prints
ID: 3611103 • Letter: D
Question
Define the following method:public static void Series(intn)
This method prints on the terminal window the series of n squarenumbers starting from one.
For instance, if n is 5, the series of numbers that isprinted is 1,4, 9, 16, 25; if n is 10, the series of numbersthat is printed is: 1,4,9, 16, 25,36,49, 64, 81, 100
The first 5 square numbers are obtained asfollows:
1*1 2*2 3*3 4*4 5*5
They are printed in the following way:
1 4 9 16 25
In the main() method, call method Series() with the followingvalues:
- 5
-a value of your choice, but biggerthan five
Explanation / Answer
import java.io.*; import java.util.*; import java.lang.*; public class SeriesSquare { public static void Series(int n) { System.out.println("The series of the numbersthat is printed:"); for(int i=1; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.