frequency of each character in a sentence , given by the user .
void main()
{
int i;
static int count[255];
char sen[1000];
{
int i;
static int count[255];
char sen[1000];
printf("\n enter a sentenc : : \n");
gets(sen);
gets(sen);
for(i=0;sen[i]!='\0';i++)
{
count[sen[i]-' ']++;
}
{
count[sen[i]-' ']++;
}
for(i=0;i<255;i++)
{
if(count[i]!=0)
{
printf("%c character has %d time ,\n",i-' ',count[i]);
}
}
{
if(count[i]!=0)
{
printf("%c character has %d time ,\n",i-' ',count[i]);
}
}
getch();
return;
}
return;
}
lets try this.........
0 Comments