I am trying to find the frequency frequency of a number in the sequence.
For example when the sequence is:
1, 1, 3, 4
should be output
< Pre> 1 found 3 times, 3 found 1 time, 4 got 1 time
and so on. I have the following code
import java.util *; Class free {public static zero main (string A []) {int c = a.length; Int d [] = new int [c]; Int num = 0; For (int p = 0; p & lt; c; p ++) d [p] = integer ParseInt (a [p]); For (int z: d) System.out.println (z); (I intend i = 0; i & lt; c - 1; i ++) // This error has occurred in the line ({int t = 0; t & lt; c - 1; i ++) {if ( D [i] == D [T]) {num ++; }} System.out.println ("element" + + "found" + "+" + "time"); Error}: Exclude the bound index
"text"> not Should be
for (int t = 0; t
be
(int t = 0; t <+ code> ) you increase the i
to another Are loop
Comments
Post a Comment