#include<stdio.h>
#include<string.h>
main()
{
char str[100],ch='a';
int i,f=0;
printf("\nEnter a string=");
gets(str);
//scanf("%s",str);
printf("\nEnter a character=");
scanf("%c",&ch);
for(i=0;i<strlen(str);i++)
{
if(str[i]==ch)
f++;
}
printf("\nFrequency of %c in %s is %d",ch,str,f);
}
#include<string.h>
main()
{
char str[100],ch='a';
int i,f=0;
printf("\nEnter a string=");
gets(str);
//scanf("%s",str);
printf("\nEnter a character=");
scanf("%c",&ch);
for(i=0;i<strlen(str);i++)
{
if(str[i]==ch)
f++;
}
printf("\nFrequency of %c in %s is %d",ch,str,f);
}
No comments:
Post a Comment