C program to remove white spaces and substitute it with underscore in a string

#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++)  

{
     if(input[i]==' ')
        output[j] = '_';
        else
        output[j] = input[i];
         j++;
}

output[j] = '\0';

printf("output string is  %s \n",output);
getch();
 return 0;             

}

Output :



C program to remove white spaces and substitute it with underscore in a string