Frequency | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Frequency

Frequency. ​Write a program in C that will receive a number from the user and output the frequency of each digit. Your program should count how many times each digit appears in the given number. You can use for loops, do-while and while loops. You must use the if-else statement. Sample output: Enter a long number: 2353822 Digit 1 appears 0 times. Digit 2 appears 3 times. Digit 3 appears 2 times.

5th Sep 2018, 4:08 PM
Murat Merekov
Murat Merekov - avatar
1 Answer
+ 2
Murat Merekov please try to do it yourself and ask specific query if you have... don't expect people to code for you entirely.. just to give you hint, you can consider number as string and use count method of algorithm to check numbers count if you want to do it with else if only, use module operator on number to find out last digit
5th Sep 2018, 4:31 PM
Ketan Lalcheta
Ketan Lalcheta - avatar