Writa a C program to find the total number of characters in a sentense excluding space

#include<stdio.h>
main()
{
int i,count;
char string[100];
i=0;
count=0;

printf("Enter a sentence :- ");
gets(string);
while(string[i]!='\0')
{
if(string[i]!=' ')
{count++;}
i=i+1;
}
printf("%d characters excluding spaces",count);
}


Post a Comment

0 Comments