Question: write a java program for the following question: Write a method printsquares that has an integer parameter n, and prints the squares of the integers

write a java program for the following question:

write a java program for the following question: Write a method printsquares

Write a method printsquares that has an integer parameter n, and prints the squares of the integers from 1 to n, separated by commas. It should print the squares of the odd integers in descending order first and then following with the squares of the even integers in ascending order. It does not print a newline character. It should throw an IllegalArgumntException if the specified integer is less than 1. For example, printsquares (4) should print 9, 1, 4, 16 printsquares (1) should print 1 printSquares (7) should print 49, 25, 9,1, 4, 16, 36

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!