C# Program to Reverse Number


-

-

Example:

Copied
using System;

public class ReverseExample  
{  
    public static void Main(string[] args)  
    {  
        int  n, reverse=0, rem;           
        Console.Write("Enter any Numbers: ");      
        n= int.Parse(Console.ReadLine()); 
        
        while(n!=0)      
        {      
            rem=n%10;        
            reverse=reverse*10+rem;      
            n/=10;      
        }      
        Console.Write("\nReversed Numbers: "+reverse);       
    }  
  }  

Output:

Enter any Numbers:
2021
Reversed Numbers: 1202