Find the number of times each digit is present in each integer. The goal of the program
Question:
Find the number of times each digit is present in each integer. The goal of the program is to learn about arrays in java.
Example: if the given integer is 222233344 then the output must print the number of times each digit is present, i.e 2 comes 4 times, 3 comes 3 times, and 4 comes 2 times.
Function Description
Complete the function frequency in the editor below. The function does not return any value and prints the digit and the number of times it occurs separated by a symbol and space (please use the same format to display the output). Frequency function has one parameter: An Integer number
Input Format for Custom testing
The first line contains an integer, n
Sample Case 0
Sample Input for Custom Testing
12122121
Sample Output
1:4
2:3
Sample Case1
Sample Input for Custom testing
0123456789
Sample Output
0:1
1:1
2:1
3:1
4:1
5:1
6:1
7:1
8:1
9:1
Please use this format to display the output
Import java.io. *;
Import java.util.*;
Import. text. *;
Import java. math.*;
Import.util.regex.*;
Public class solution {
Public static void main (String args[] throws Exception{
/*Enter your code here. Read input from STDIN. Print output to STDOUT*/
}
}
An Introduction To Statistical Methods And Data Analysis
ISBN: 9781305465527
7th Edition
Authors: R. Lyman Ott, Micheal T. Longnecker