Write a program in c# (c sharp) to accept a string from user and display the reverse of a string .
using System;namespace ReverseofString
{
class Program
{
static void Main(string[] args)
{
string str1, str2 = "";
int len, i;
Console.WriteLine("Enter a String:");
str1 = Console.ReadLine();
len = str1.Length;
for (i = len - 1; i >= 0; i--)
{
str2 = str2 + str1[i];
}
Console.WriteLine("Reverse of the entered string is: " + str2);
Console.ReadKey();
}
}
}
If anyone have any doubt about the program , please comment and you can also mail me on "ibsarmschauhan13@gmail.com" and "makansingh42@yahoo.com".
No comments:
Post a Comment