I'm trying to get the user to enter an integer and then make the output print the number of digits entered. Ex. If I enter 1123 or some other number, how do I make it display this? ( and for any number I enter )Code:int dat; printf( "\nEnter an int: " ); scanf( "%d", &dat ); printf( "\nThe counts of digits:\n0 %d\n" "1 %d\n" "2 %d\n" "3 %d\n" "4 %d\n" "5 %d\n" "6 %d\n" "7 %d\n" "8 %d\n" "9 %d\n", );
0 0
1 2
2 1
3 1
4 0
5 0
6 0
7 0
8 0
9 0
The right column shows the numbers I entered and how many times it occured. I'm not sure know how to extract the digit using loops, "if", etc and compare it with the # to make it show the number of times it occured.