Program to remove spaces from a string | faceprep

Program to remove spaces from a string | faceprep

The program to remove spaces from a string is discussed here. Given a string containing white spaces, the task is to remove all the spaces from the string and produce it as output.

For example, consider the following string.

program to remove spaces from a string


Input 1 :

Hello All. Welcome to Face

Output 1:

HelloAll.WelcometoFace

Input 2:

F a c e

Output 2:

Face

Algorithm to remove spaces from a string

  • Input the string.
  • Convert the string as a character array.
  • Traverse the character array.
  • If the character encountered is not an empty space, print it.
  • If the character encountered is an empty space, skip the character.


face prep pro ad bannerClick here to learn more about FACE Prep PRO


Program to remove white spaces from a string

@@coding::1@@


Recommended Programs


Program to remove spaces from a string

c