Sentence application

frequency of each character in a sentence , given by the user .
‪#‎include‬<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
int i;
static int count[255];
char sen[1000];
printf("\n enter a sentenc : : \n");
gets(sen);
for(i=0;sen[i]!='\0';i++)
{
count[sen[i]-' ']++;
}
for(i=0;i<255;i++)
{
if(count[i]!=0)
{
printf("%c character has %d time ,\n",i-' ',count[i]);
}
}
getch();
return;
}

lets try this.........

Post a Comment

0 Comments