C# program to find reverse of a given number
using System; namespace ReverseNumber { class Program { static void Main(string[] args) { int num, rem, sum = 0, rev; Console.WriteLine("\n /** To Find Reverse Of a Number **/"); Console.Write("\n Enter a number: "); num=Convert.ToInt32(Console.ReadLine()); while (Convert.ToBoolean(num)) { rem = num % 10; //for getting remainder by dividing with 10 num = num / 10; //for getting quotient by dividing with 10 sum = sum * 10 + rem; } rev = sum; Console.WriteLine("\n The Reversed Number is: {0} \n\n", rev); Console.ReadLine(); } } }
Output:
Great Explanation..Very good Example..
ReplyDeleteOnline CSharp
Training
C Sharp Training
Online C# Training from India
C Sharp Training in Chennai
C# Training
Online Dot Net Training
.net online Training
ASP NET Training
This comment has been removed by the author.
DeleteReverse Number Program in C
ReplyDeleteGood post
how does it works please explain
ReplyDeleterem = num % 10;
num = num / 10;
sum = sum * 10 + rem;
this logic
A really nice article is pretty good.
ReplyDeletebest c sharp training institute in chennai
Nice and informative article.....
ReplyDeletelearn programming with examples.....
Switch Case in C examples
Functions in C, examples
Number Series in C examples
Pointers in C examples
Bitwise -Operators in C examples
File handling in C examples and many more...
New and used slot machines - Pragmatic Play - AprCasino
ReplyDeleteNEW AND NEW 1xbet 먹튀 SLOT gri-go.com MACHINES kadangpintar WITH A aprcasino HIGH RTP! For the ultimate high-quality gaming experience, Pragmatic Play offers all of 출장안마 the