programming-examples/c-sharp/Strings/C# Sharp to print individual characters of the string in reverse order.cs

21 lines
644 B
C#
Raw Normal View History

2019-11-15 12:59:38 +01:00
using System;
public class Exercise4
{
public static void Main()
{
string str;
int l=0;
Console.Write("\n\nprint individual characters of string in reverse order :\n");
Console.Write("------------------------------------------------------\n");
Console.Write("Input the string : ");
str = Console.ReadLine();
l = str.Length - 1;
Console.Write("The characters of the string in reverse are : \n");
while (l >= 0)
{
Console.Write("{0} ", str[l]);
l--;
}
Console.Write("\n\n");
}
}