Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Frequency {
- public static void main(String[] args){
- Scanner scan = new Scanner(System.in);
- int[] numbers;
- System.out.print("enter numbers: ");
- int [] attribute = new int[51];
- Scanner boomerang = new Scanner(System.in);
- while (true){
- int num = boomerang.nextInt();
- if (num <0 || num >50)
- {break;}
- attribute[num]++;}
- for (int i=0; i < 51; i++){
- if (attribute[i]>0){
- System.out.println(attribute[i]+" occurences of " + i);}}}}
Add Comment
Please, Sign In to add comment