void main()
{
int i,j,len=0,word=1,lens=0,ll=1;
char str[100];
clrscr();
printf("ENTER THE STRING: ");
gets(str);
for(i=0;str[i]!='\0';i++)
{
len++;
if(str[i]==' ')
word++;
else
lens++;
}
printf("CHARACTERS WITH SPACE : %d\n",len);
printf("CHARACTERS WITHOUT SPACE : %d",lens);
printf("\n WORDS : %d",word);
getch();
}
OUTPUT :
ENTER THE STRING: KAMLESH MENGAR
CHARACTERS WITH SPACE : 14
CHARACTERS WITHOUT SPACE : 13
WORDS : 2