71
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
- Define a string.
- Define a for-loop in which loop variable will start from 0 and end at length of the string.
- To separate each character, we will print the character present at every index.
- 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#