include


replace(char s,char c1,char c2)
{ while(
s!=’\0’)
{ if (s==c1)
s=c2;
s++;

}
}
main()
{ FILE *fp;
char str[100],a,b;
if((fp=fopen(“p10_2.out”,”w”))==NULL)
{ printf(“cannot open the file\n”);
exit(0); }
printf(“Enter a string:\n”);
gets(str);
printf(“Enter a&&b:\n”);
scanf(“%c,%c”,&a,&b);
printf(“%s\n”,str);
fprintf(fp,”%s\n”,str);
replace(str,a,b);
printf(“The new string is——%s\n”,str);
fprintf(fp,”The new string is——%s\n”,str);
fclose(fp);
}