#include<stdio.h>
#include<conio.h>
main()
{
char string[150], Mychar;
int count=0, j=0;
printf("Please enter a string:\n");
gets(string);
printf("Please enter the character for find occurances of that: \t");
scanf("%c", &Mychar);
while(string[j]!='\0')
{
if(string[j]==Mychar)
count++;
j++;
}
printf("Above string contains %c occurred %d times \n",Mychar, count);
getch();
}This code snippet is for take some input from user & count the number of occurrences of any character from that input string.
