C program to find the maximum occuring element in the string
#include <stdio.h>
int main()
{
char str[20];
int i,cnt, max=1,temp=0,j;
printf("enter the string\n");
scanf("%[^\n]%*c",str);
for(i=0;str[i]!='\0';i++)
{
cnt=1;
for(j=i+1;str[j]!='\0';j++)
{
if(str[i]==str[j] && str[j]!='*' && str[j]!=' ')
{
cnt++;
str[j]='*';
}
}
if(cnt>max)
{
max=cnt;
temp=i;
}
}
printf("%c is the maximum occuring element with maximum number %d",str[temp],max);
return 0;
}
Output:
enter the string
never give up
e is the maximum occuring element with maximum number 3
7 Comments
Great Content. It will useful for knowledge seekers. Keep sharing your knowledge through this kind of article.
ReplyDeletePerl Certification Course in Chennai
Node JS Training Institutes in chennai
ReplyDeleteNice blog! Thanks for sharing this valuable information
Angularjs Training in Bangalore
Angularjs classes in pune
Angularjs Training in hyderabad
Angularjs Training in Gurgaon
Angularjs Training in delhi
This post is so interactive and informative.keep updating more information...
ReplyDeleteArtificial Intelligence Course in Mumbai
Artificial Intelligence Course in Ahmedabad
Artificial Intelligence Course in Kochi
Artificial Intelligence Course in Trivandrum
Artificial Intelligence Course in Kolkata
ReplyDeleteGet inspired by your blog. Keep doing like this....
Spoken English Classes in Bangalore
Spoken English Classes in Pune
spoken english centre in Hyderabad
English Speaking Course in Gurgaon
English speaking course in Delhi
This post is so interactive and informative.keep updating more information...
ReplyDeleteAndroid Training in Mumbai
Android Training in Ahmedabad
Android Training In Kochi
Android Training in Trivandrum
Android Development Course in Kolkata
Scope of Android Development in 2021
This blog helps me to get valuable information thanks for this informative blog.
ReplyDeleteoracle training in Chennai
oracle online course
oracle training in Coimbatore
ReplyDeleteNice post Thank for sharing
DevOps Online Training
DevOps Training in Chennai
DevOps Training in Bangalore
Post a Comment