Counting repeated elements in an integer array

前端 未结 13 1326
挽巷
挽巷 2020-11-27 08:02

I have an integer array crr_array and I want to count elements, which occur repeatedly. First, I read the size of the array and initialize it with numbers read

13条回答
  •  一个人的身影
    2020-11-27 08:23

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int[] numbers=new int[5];
        String x=null;
        System.out.print("enter the number 10:"+"/n");
        for(int i=0;i<5;i++){
            numbers[i] = input.nextInt();
        }
        System.out.print("Numbers  :  count"+"\n");
        int count=1;
        Arrays.sort(numbers);
        for(int z=0;z<5;z++){
            for(int j=0;j

提交回复
热议问题