Header Ads Widget

Responsive Advertisement

Individual Frequency of A Character in A String

 




#include<stdio.h>
#include<string.h>
int main()
{
    char str[100];
    char c;
    int count=0;
    printf("Enter A String : ");
    gets(str);
    for(c='a'&&'A'; c<='z'&&'Z'; c++)
    {    count=0;
        for(int i=0; str[i]!='\0'; i++)
        {
            if(c==str[i]) {
                count++;
            }
        }
        if(count>0)
        printf("\nThe Character ' %c ' Present = %d Times",c,count);
    }

    return 0;
}


Post a Comment

0 Comments