This is a Sample C Program To Accept A String & Find Out Whether This Character Is Present In The String. If Present Then Display How Many Times This Character Occurs. #include<stdio.h> #include<conio.h> #include<string.h> void s(char *p,char hc); void main() { char str[10]; char ch; clrscr(); printf(" \n \n Enter the string: \t "); gets(str); printf(" \n \n Enter the character: \t "); scanf("%c",&ch); s(str,ch); } void s(char *p,char hc) { int a = 0; int i,l; l = strlen(p); for(i = 0; i < l; i++) { if ( p[i] == hc) { a++; } else continue; } printf(" \n \n The Entered Character occurs %d times. ", a); getch(); } OUTPUT: Enter the string: Googleplus Enter the character: l The Entered Character occurs 2 times. ALSO R...
All HR and Technical interview questions with answers for freshers and experienced professional. It helps job seekers who are about to attend interviews.