// Version 1: use foreach-loop.
foreach (char c in value)
{
Console.WriteLine(c);
}
// Version 2: use for-loop.
for (int i = 0; i < value.Length; i++)
{
Console.WriteLine(value[i]);
}
using System;
class Program {
static void Main(string[] args) {
string given_string = "Hello World";
foreach (char character in given_string) {
Console.WriteLine(character);
}
}
}
//iterate over a string
using System;
public class Test
{
public static void Main()
{
string iterate = "abcd";
for(int i=0;i<iterate.Length;i++)
{
Console.WriteLine(iterate[i]);
}
}
}