Write a program in c# to reverse a String.
Sample Output
Sample Solution
C# Sharp Codeusing System; using System.Collections.Generic; namespace AccessSpecifiers { class Program { static void Main(string[] args) { string name, stringreverse = ""; int Lenth; Console.Write("Enter string :- "); name = Console.ReadLine(); Lenth = name.Length - 1; while (Lenth >= 0) { stringreverse = stringreverse + name[Lenth]; Lenth--; } Console.WriteLine("Revesse string is: " + stringreverse); Console.ReadLine(); } } }
Sample Output
No comments:
Post a Comment