---
title: "C# Program to Reverse the order of a Number."  
description: "C# Program to Reverse the order of a Number."  
author: "Steilla Mitchel"  
published: 2023-02-14  
updated: 2023-06-15  
canonical: https://www.mindstick.com/forum/157402/c-sharp-program-to-reverse-the-order-of-a-number  
category: "c#"  
tags: ["c#", "java", "programs"]  
reading_time: 2 minutes  

---

# C# Program to Reverse the order of a Number.

How to find the [reverse order](https://www.mindstick.com/forum/156836/what-is-a-c-sharp-program-to-print-individual-from-a-string-in-reverse-order) of a given number using the [C# program](https://www.mindstick.com/forum/156830/how-do-i-make-a-c-sharp-program-that-checks-for-given-array-by-user-which-elements-are-perfect-numbers)?

## Replies

### Reply by Aryan Kumar

Sure, here is a C# program to reverse the order of a number:

C#

```plaintext
using System;

public class ReverseNumber {

    public static void Main(string[] args) {
        int number = int.Parse(Console.ReadLine());
        int reversedNumber = 0;

        while (number > 0) {
            int digit = number % 10;
            reversedNumber = reversedNumber * 10 + digit;
            number /= 10;
        }

        Console.WriteLine("Reversed number: " + reversedNumber);
    }
}
```

This program works by first getting the number from the user. Then, it uses a loop to reverse the order of the digits in the number. Finally, it prints the reversed number to the console.

Here is an example of how the program would work:

Code snippet

```plaintext
Enter a number: 12345
Reversed number: 54321
```

### Reply by Ashutosh Patel

There is a simple C# [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program) to [reverse](https://www.mindstick.com/blog/63740/what-are-the-most-effective-and-safest-thanks-to-reverse-erectile-dysfunction) the [order](https://www.mindstick.com/articles/12276/how-timely-order-deliveries-can-improve-customer-experience) of a given number,

```cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HelloWorld
{
   class Program
   {
       static void Main(string[] args)
       {
           int num = 98547, res = 0;
           Console.WriteLine("Actual Number is : {0}", num);
           while (num != 0)
           {
               res = res * 10;
               res = res + num % 10;
               num = num / 10;
           }
           Console.WriteLine("Number after reverse : "+res);
           Console.ReadLine();
       }
   }
}

Output:
	Actual Number is : 98547
	Number after reverse : 74589
```


---

Original Source: https://www.mindstick.com/forum/157402/c-sharp-program-to-reverse-the-order-of-a-number

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
