+ 4

C program to find frequency of integers in a string

4th Mar 2019, 2:01 PM
Punnam Ruthvik Reddy
11 Answers
+ 4
diego Code I am a beginner.I have not yet completed studying ctype headerfile.Can u help me in another way Thanks a lot
5th Mar 2019, 1:07 PM
Punnam Ruthvik Reddy
+ 3
I need to find the frequency of only numbers by neglecting the charecters in the string Example Input IND2020 output:frequency of 2 is 2 Frequency of 0 is 2
4th Mar 2019, 3:01 PM
Punnam Ruthvik Reddy
+ 3
*Asterisk* can u give me an idea how can I modify the program u mentioned to string
5th Mar 2019, 1:03 PM
Punnam Ruthvik Reddy
+ 3
diego Code I am a beginner.I have not yet completed studying ctype headerfile.Can u help me in another way Thanks a lot
5th Mar 2019, 1:06 PM
Punnam Ruthvik Reddy
+ 2
First of all take a number as input and put a switch case for 0-9 integers. Now do number%10,number divided by 10 until it reaches 0. Inside switch case put count[i]. After this we can output frequency of each integer. Put a for loop for printing frequency from i=0 to i=9
4th Mar 2019, 2:41 PM
Ragan Murali Pasupuleti
Ragan Murali Pasupuleti - avatar
+ 2
String is the mixture of characters and numbers I think the solution u mentioned doesn't work.
4th Mar 2019, 2:47 PM
Punnam Ruthvik Reddy
+ 2
We can do typecasting
4th Mar 2019, 2:54 PM
Ragan Murali Pasupuleti
Ragan Murali Pasupuleti - avatar
+ 2
Then by using ascii values we can count frequency by taking input as string
4th Mar 2019, 3:03 PM
Ragan Murali Pasupuleti
Ragan Murali Pasupuleti - avatar
4th Mar 2019, 11:41 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
I've included ctype.h to use isdigit() only... You can replace the if (isdigit()) with if (*s >= '0' && *s <= '9')
5th Mar 2019, 1:36 PM
unChabon
unChabon - avatar
5th Mar 2019, 7:33 AM
unChabon
unChabon - avatar