title: replacing a character in string in C
body: <p>Have to replace a user input character with another user input character and print the string . What am i doing wrong ?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  main()
  {
  int i;
  char a,b,str[100];
  printf("Enter the string");
  gets(str);
  //asking for replacement
  printf("enter the character to be replaced");
  scanf("%c",&amp;a);
  // which letter to replace the existing one
  printf("enter the character to replace");
  scanf("%c",&amp;b);
  for(i=0;str[i]!='\0';i++)
  {
      if(str[i]==a)
      {
      str[i] = b;
      }
      else
      continue;
  }
  printf("the new string is");
  puts(str);
  }
  </code></pre>