programming-examples/c-sharp/Strings/C# Program to Reverse a String without using Reverse function.cs

26 lines
651 B
C#
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* C# Program to Reverse a String without using Reverse function
*/
using System;
class Program
{
static void Main(string[] args)
{
string Str, reversestring = "";
int Length;
Console.Write("Enter A String : ");
Str = Console.ReadLine();
Length = Str.Length - 1;
while (Length >= 0)
{
reversestring = reversestring + Str[Length];
Length--;
}
Console.WriteLine("Reverse String Is {0}", reversestring);
Console.ReadLine();
}
}
/*
Enter a String : sanfoundry
Reverse String is : yrdnuofnas