Here’s my solution:
#include <stdio.h>
int main()
{
char sentence [100];
int i,letter_count=0;
printf("Enter a sentence: ");
fgets(sentence,100,stdin);
for(i=0;sentence [i]!='\0';i++)
{
if(sentence [i]==' ' || sentence [i+1]=='\0')
{
if(letter_count%2==1)
{
printf("%c ",sentence [i-letter_count/2-1]);
}
letter_count=0;
}
else
{
letter_count++;
}
}
putchar('\n');
return 0;
}
2
solved Can anyone help me how to creat a c program prints the center of the words inside a sentance? [closed]