display reverse numbers using c#

Gow.net
Posted by Gow.net under C# category on | Points: 40 | Views : 1581
string inp = "1234567890";
string result = string.Empty ;
for (int i = inp.Length-1; i >= 0; i--)
{
result = result + inp;
}
Console.write("Reversed value is:"+result );

Comments or Responses

Posted by: Siyyappan21 on: 2/12/2012 Level:Starter | Status: [Member] | Points: 10
One small correction Mr: Gow.net

string inp = "1234567890";

string result = string.Empty ;

for (int i = inp.Length-1; i >= 0; i--)

{

result = result + inp[i]; // this line.

}

Console.write("Reversed value is:"+result );
Posted by: Gow.net on: 2/13/2012 Level:Starter | Status: [Member] | Points: 10
hi Siyyappan21 Sir that line no error in my coding
my code
result = result + inp;

your correction
result = result + inp; // this line. 

i cant find out that error please tell me clearly sir
Posted by: Raj_Chennai on: 4/17/2012 Level:Starter | Status: [Member] | Points: 10
hi, is this code working properly i tried the execution of this code but it returns the output wrongly.kindly check the code

Posted by: amanueljoseph-9523 on: 9/5/2012 Level:Starter | Status: [Member] | Points: 10
Try this one.

class Program
{
static void Main(string[] args)
{
char[] inp = "123456789".ToCharArray();

string result = string.Empty;

for (int i = inp.Length - 1; i >= 0; i--)
{

result += inp[i];

}

Console.WriteLine("Reversed value is:" + result);
}
}

Login to post response