For Doing this you may run a 'for' loop. and doing mod by 10.
here is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace reverse
{
class Program
{
static void Main(string[] args)
{
int a, b;
a = int.Parse(Console.ReadLine());
for(int i=a;i>0;i=i/10)
{
b = i % 10;
Console.Write(b);
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment