You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
651 B
C#

/*
* 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