#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
int c_count=0,temp;
char str[200],ch;
clrscr();
printf("Enter string: ");
gets(str);
printf("\nEnter character which you want to count: ");
scanf("%c",&ch);
for(temp=0;temp<=strlen(str);temp++)
{
if(str[temp]==ch)
{
c_count++;
}
}
printf("\nEntered character is included %d times in string",c_count);
getch();
}
#include<conio.h>
#include<string.h>
main()
{
int c_count=0,temp;
char str[200],ch;
clrscr();
printf("Enter string: ");
gets(str);
printf("\nEnter character which you want to count: ");
scanf("%c",&ch);
for(temp=0;temp<=strlen(str);temp++)
{
if(str[temp]==ch)
{
c_count++;
}
}
printf("\nEntered character is included %d times in string",c_count);
getch();
}