Tuesday, December 27, 2011
9:14 PM

C Program to Remove Spaces From the String


Program to Remove Spaces From the String





#include
void main(){char a[20];int i,j,b;printf("enter the string: ");gets(a);for(i=0;a[i]!='\0';i++){if(a[i]==' '){printf("do you want to remove %d blank 1/0:" ,i+1); scanf("%d",&b); if(b==1) { j=i; for(; a[j]!='\0';j++) a[j]=a[j+1]; } else continue; } } for(j =0 ; a[j]!='\0';j++) printf("%c",a[j]); }

0 comments:

Post a Comment