#include<stdio.h>
#include<conio.h>
#include<STRING.H>
main()
{
char ch[30],ca,i,c=0;
printf("Enter the text:\n");
gets(ch);
printf("Enter the character:\n");
ca=getchar();
for(i=0;ch!='\0';++i)
{
if(ch[i]==ca)
{
c+=1;
}
}
printf("Number of occurances= %d",c);
return 0;
}
No comments:
Post a Comment