AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
3. Our Experts are looking for yours ?.

# corejava-programming: Write a java program of digit counter

 Digit Counter Suman works with a firm where he has to count the number of digits given to him. Manual counting of digits takes a long time. So being a Graduate Trainee in TCS your job is to help shyam in digitizing the counting work given to him. So if the array is 12,44,85,65,88 then your job is to print the most occurred digit and the digit that never occurred. Digits to be counted will range from 0 to 9 In the above array, most occurred digit is 8 and digits that did not occur at all are 0,3,7,9. Write a java program to achieve the above mentioned problem Input Specification line one size of array (size between 1 and 100) followed by elements of array Output Specification Print the most occurred digit and digit that never occurred in two separate lines. Sample Input: 4 125 104 44 64 Sample Output: Most occurred digit : 4 Digits that did not occur : 3,7,8,9 Note: If there are two or more digits that has occurred more, than print the greater of them. (for e.g. if 4,5 are most occurred digit than print 5) corejava x 353programming x 169 Posted On : 2018-02-05 17:56:14.0 Ananya 4100 3 import java.util.Scanner; public class DigitCounter { public static void main(String[] args) { Scanner input=new Scanner(System.in); int n=input.nextInt(); Integer number=0; int temp =0; int max=0; char mostOccuredDigit= ' '; int[] digits=new int;//assume array index represents 0-9 digits for(int i=0;imostOccuredDigit){ mostOccuredDigit=digit; } } } System.out.println(""); System.out.println("Most occurred digit : "+mostOccuredDigit); System.out.print("Digits that did not occur : "); boolean isFirst=true; for(int j=0;j
its showing error @garima....
char mostOccuredDigit='';
Posted On :2018-02-07 21:30:13.0