Javatpoint Logo
Javatpoint Logo

Program to separate the individual characters from a string

Explanation

In this program, we need to separate each character from the string.

In computer science, collection of characters including spaces is called as string. To separate an individual character from the string, individual character are accessed through its index.

Algorithm

  1. Define a string.
  2. Define a for-loop in which loop variable will start from 0 and end at length of the string.
  3. To separate each character, we will print the character present at every index.
  4. To visualize this, we have separated each character by a space.

Solution

Python

Output:

Individual characters from given string: 
c  h  a  r  a  c  t  e  r  s  

C

Output:

Individual characters from given string:
c  h  a  r  a  c  t  e  r  s  

JAVA

Output:

Individual characters from given string:
c  h  a  r  a  c  t  e  r  s  

C#

Output:

Individual characters from given string:
c  h  a  r  a  c  t  e  r  s  

PHP

Output:

Individual characters from given string:
c  h  a  r  a  c  t  e  r  s  

Next Topic#




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA