Question
Write a method called listOfDigits(), which will accept two arguments ( min and max ). The method will return an integer array that contains every
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started