Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

C# Sharp Exercises: Separate the individual characters from a string

C# Sharp String: Exercise-3 with Solution

Write a program in C# Sharp to separate the individual characters from a string.

C# Sharp Exercises: Separate the individual characters from a string

Sample Solution:-

C# Sharp Code:

using System;  
public class Exercise3
{  
    public static void Main() 
        {
            string str; 
            int l=0;
	
      Console.Write("\n\nSeparate the individual characters from a string :\n");
      Console.Write("------------------------------------------------------\n"); 	
      Console.Write("Input the string : ");
      str = Console.ReadLine();
	  Console.Write("The characters of the string are  :  ");
            while (l <= str.Length - 1)
            {
                Console.Write("{0} ", str[l]);
                l++;
            }
                Console.Write("\n\n");
        }
}

Sample Output:

Separate the individual characters from a string :                                                            
------------------------------------------------------                                                        
Input the string : w3resource.com                                                                             
The characters of the string are  :  w 3 r e s o u r c e . c o m 

Flowchart:

Flowchart: Separate the individual characters from a string.

C# Sharp Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a program in C# Sharp to find the length of a string without using library function.
Next: Write a program in C# Sharp to print individual characters of the string in reverse order.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.