C program to find the maximum occurring character in a string using a while loop. | सी प्रोग्राम एक लूप का उपयोग करके स्ट्रिंग में अधिकतम होने वाले चरित्र को खोजने के लिए।












C program to find the maximum occurring character in a string using a while loop.




C program to find the maximum occurring character in a string using a while loop.



#include <stdio.h> #define MAX 100 #define MAXC 255 int main() { char text[MAX]; int freq[MAXC]; int i = 0, max; int ascii; printf("\n Enter any string: "); gets(text); for(i=0; i freq[max]) max = i; } printf("\n Maximum occurring character in the given is '%c' = %d times.", max, freq[max]); return 0; }


Output:

Enter any string: I love c program coding Maximum occurring character is ' ' = 5 times.



Exercise: 1
C program to find a maximum occurring character in a string.