Wap to count no of time a element present in array
Answers
Answered by
1
public static void main()
{
int a[] = {1, 4, 5, 3, 4, 6, 4, 2, 4, 2, 1, 5, 2, 3};
for (int i = 0, cnt = 0; i<=a.length; i++)
{
System.out.println(a[i]);
for (int j = 0; i<=a.length; i++)
{
if (a[i] == a[j]);
cnt++;
}
System.out.print(cnt);
}
}
Hope this helps :)
Similar questions
French,
7 months ago
Psychology,
7 months ago
Math,
1 year ago
Math,
1 year ago
Social Sciences,
1 year ago