Question: Java Code Write a method called listOfDigits(), which will accept two arguments ( min and max ). The method will return an integer array that
Java Code
Write a method called listOfDigits(), which will accept two arguments ( min and max ). The method will return an integer array that contains every digit between and including min and max, this method should implement a for loop, a while loop or a do while loop.
package finalexam;
import java.util.Scanner; public class FinalExam { public static void main(String[] args) { Scanner stdin = new Scanner( System.in ); int min, max; int[] array; System.out.println( "Display Elements between Min and Max" ); System.out.print( "Enter Minimum: " ); min = stdin.nextInt(); System.out.print( "Enter Maximum: " ); max = stdin.nextInt(); array = listOfDigits( min, max ); System.out.print( "Output Array : " ); for ( int lp=0; lp Sample ExecutionDisplay Elements between Min and Max
Enter Minimum: 4 Enter Maximum: 9 Output Array : 4 5 6 7 8 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
