Raymond P.

asked • 09/30/22

Methods with loops are destroying my brain, help!

Define the method printValues() that takes two integer parameters and outputs all integers starting with the first and ending with the second parameter in reverse order, each followed by a newline. The method does not return any value.

Ex: If the input is 3 7, then the output is:

7
6
5
4
3


import java.util.Scanner;


public class ValuePrinter {


/* Your code goes here */


public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int numberA;

int numberB;


numberA = scnr.nextInt();

numberB = scnr.nextInt();

printValues(numberA, numberB);

}

}


I have a general idea of what to code, but I honestly don't understand how the input/output works in this question. Below is all I have an idea of.

public static void printValues (int numberA, int numberB) {

}


1 Expert Answer

By:

Jeff W. answered • 09/30/22

Tutor
5 (15)

Retired Software Engineer tutoring C/C++, C#, Python

Raymond P.

Okay, yeah, I definitely didn't understand what the question was asking for. It's so simple when its put like that. Thank you very much!
Report

09/30/22

Jeff W.

No problem!
Report

09/30/22

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.