Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Frequency {
  3. public static void main(String[] args){
  4. Scanner scan = new Scanner(System.in);
  5.  
  6. int[] numbers;
  7. System.out.print("enter numbers: ");
  8. int [] attribute = new int[51];
  9. Scanner boomerang = new Scanner(System.in);
  10.  
  11. while (true){
  12. int num = boomerang.nextInt();
  13. if (num <0 || num >50)
  14. {break;}
  15. attribute[num]++;}
  16.  
  17. for (int i=0; i < 51; i++){
  18. if (attribute[i]>0){
  19. System.out.println(attribute[i]+" occurences of " + i);}}}}
Add Comment
Please, Sign In to add comment