public class Class1
{
public static void Main()
{
Console.WriteLine("Enter the string");
string sourcestring = Console.ReadLine().Trim().ToUpper();
int rightIndex = sourcestring.Length - 1;
int leftIndex = 0;
StringBuilder resultentString = new StringBuilder();
do {
resultentString.Append(sourcestring[leftIndex]);
leftIndex++;
if (leftIndex > rightIndex) break;
resultentString.Append(sourcestring[rightIndex]);
rightIndex--;
}
while (leftIndex <= rightIndex);
Console.WriteLine("Given string is : {0} and after shuffling the resultent string is {1}", sourcestring, resultentString.ToString());
Console.ReadLine();
}
}One more Interview program I come across, shuffling of string First and Last manner.
