#include <stdio.h>
#include <conio.h>
void main()
{
char str[]="Noone can understand programming easily";
int i,count=0;
char ch;
printf("Enter required character: ");
scanf("%c",&ch);
for(i=0;str[i]!='\0';i++)
{
if(str[i]==ch)
count++;
}
if(str[i]==ch)
count++;
}
printf("Number of '%c' is %d",ch,count);
getch();
}
OUTPUT:
No comments:
Post a Comment