I'm new to writing code. I need to make a program that reads in 15 numbers into an array that are between 0-50 and then print the occurrences. This is what I have so far.
import java.util.Scanner;
public class Occurrence
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int [] nmberchck = new nmberchck[50];
int[] numbs = new int[15];
System.out.println("Enter 15 numbers that are between 0 and 50 ");
System.out.println();
numbs[0] = scan.nextInt();
numbs[1] = scan.nextInt();
numbs[2] = scan.nextInt();
numbs[3] = scan.nextInt();
numbs[4] = scan.nextInt();
numbs[5] = scan.nextInt();
numbs[6] = scan.nextInt();
numbs[7] = scan.nextInt();
numbs[8] = scan.nextInt();
numbs[9] = scan.nextInt();
numbs[10] = scan.nextInt();
numbs[11] = scan.nextInt();
numbs[12] = scan.nextInt();
numbs[13] = scan.nextInt();
numbs[14] = scan.nextInt();
for (int nmb = 0; nmb < numbs.length; nmb++)
Thank you
Aucun commentaire:
Enregistrer un commentaire