/* This program inputs a list of positive numbers (we assume between 1 and 99) from the user to store in an array. * It then iterates from 1 to 99 and for each number, iterates through the array to count the number of times that * number (e.g., 1) appears in the array. If the number appears any number of times, the program outputs the * number and how many times it appears. */ import java.util.Scanner; public class Prog7_3 { public static void main(String[] args) { int[] values = new int[100]; // assume a list of no more than 100 elements int number = 0; // number of elements currently in the array int temp; // to store the input value temporarily Scanner in = new Scanner(System.in); System.out.print("Enter a list of values, one at a time, ending with 0 "); temp = in.nextInt(); while(temp>0&&number<100) // iterate while the input is legal and we have room in the array { values[number++] = temp; // add the latest input to the array and get the next input System.out.print("Enter the next value, 0 to exit "); temp = in.nextInt(); } int count; // to count how many times a given number appears in the array for(int i=1;i<=99;i++) { count=0; // (re)set count to 0 before we start counting the next value for(int j=0;j0) System.out.println("The value " + i + " appears " + count + " times"); // if we found any i's in the array, output how many } } }