#include <stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char input[50], output[50];
int i = 0, j = 0, count = 0;
printf("Enter intput string \n");
gets(input);
printf("input string is %s \n",input);
count = strlen(input);
for(i = 0; i<count; i++) //Insert Space between each character
{
output[j] = input[i];
j++;
output[j] = ' ';
j++;
}
output[j] = '\0';
printf("output string is %s \n",output);
getch();
return 0;
}
Output :
C program to insert space after every character in a sentence
#include<conio.h>
#include<string.h>
int main()
{
char input[50], output[50];
int i = 0, j = 0, count = 0;
printf("Enter intput string \n");
gets(input);
printf("input string is %s \n",input);
count = strlen(input);
for(i = 0; i<count; i++) //Insert Space between each character
{
output[j] = input[i];
j++;
output[j] = ' ';
j++;
}
output[j] = '\0';
printf("output string is %s \n",output);
getch();
return 0;
}
Output :