26 lines
651 B
C#
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
|