//count repitation of a character from stringCount Repetation of Character from Given String
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
char ch[10],c;
int count=0;
clrscr();
printf("Enter any string= ");
gets(ch);
printf("Enter any character from string= ");
c=getch();
for(i=0;ch[i]!='\0';i++)
{
if(ch[i]==c)
{
count++;
}
}
printf("\nrepitation of %c = %d times",c,count);
getch();
}
No comments:
Post a Comment