Write a program that replaces two or more consecutive blanks in a string by a single blank.

 #include <stdio.h>


int main ()

{

  char n[50];

  

  printf("Enter string");

  scanf("%[^\n]s", n);

  

  int i=0, f=0;

  while(n[i]!='\0')

  {

      if(n[i]==32)

       { if(f==0)

           printf("%c", n[i]);

         f++;

         i++; }

      else

        {printf("%c", n[i]);

         i++;

         f=0;

        }

  }

 

  return 0;

}

Comments