Skip to main content

Reverse number program in c#

Reversing given number without using any built-in function or method just use only basic function, this is often asked question in the interview.

Following sample code is for reversing number using simple basic function, method takes only a number as input and returns reversed number of given input number in c#.

WAP For Reverse Number - Code in C#

public int reverseNumber(int Number)
    int ReverseNumber = 0;
    while(Number > 0)
        ReverseNumber = (ReverseNumber * 10) + (Number % 10);
        Number = Number / 10;
    return ReverseNumber;

Output :

Entered Number : 11223344
Output Number : 44332211

Popular posts from this blog

regex - check if a string contains only alphabets c#

How to validate that input string contains only alphabets, validating that textbox contains only alphabets (letter), so here is some of the ways for doing such task. char have a property named isLetter which is for checking if character is a letter or not, or you can check by the regular expression  or you can validate your textbox through regular expression validator in Following code demonstrating the various ways of implementation.

How to validate dropdownlist in JavaScript

In this article you will see how to put validation in dropdownlist by javascript, suppose first item value of dropdownlist is 0 and text is "-Select-" just like given below and we have to validate that at least one item is selected excluding default i.e "-Select-".

Uploading large file in chunks in Mvc c# from Javascript ajax

Often we have a requirement to upload files in, Mvc c# application but when it comes to uploading larger file, we always think how to do it as uploading large file in one go have many challenges like UI responsiveness, If network fluctuate for a moment in between then uploading task get breaks and user have to upload it again etc.

how $document.ready() is different from window.onload()

we often use window.onload() in javascript and $document.ready() in jquery and assume that both are same just jquery library wrap up javascript window.onload() and introduce $document.ready() but no there is much difference between them below is the explanation -