Below is a program I am working on that is supposed to take in a list of numbers
ID: 3778955 • Letter: B
Question
Below is a program I am working on that is supposed to take in a list of numbers into an array and then read them back indicating the smallest number with the following printed beside it (<---smallest number). I do not understand why the program is not printing the right output. Please help! Below my program is the CORRECT sample output but NOT the one I am receiving. Thank you!
import java util Scanner public class SmallestInArray public static void main StringO args)H final int LENGTH 100 int value 1; int currentSize 0; int O values new int 11001 Read inputs System. out printInC"Please enter values, Q to quit: Scanner scan new Scanner System. in while Oscan. hasNextDoubleC) && currentSize values length) values Dvalue scan nextIntO; current Size++ double smallest values C01 for (int i 1; iExplanation / Answer
Every number's remainder with 1 is always 0. Try this
for(i=0;i<currentSize;i++){
System.out.print(values[i]);
if(values[i]==smallest){
System.out.println(" <==smallest value");
}else{
System.out.println();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.