Reversing the numbers - c# program, DOT NET Programming

Assignment Help:

Reversing the Numbers - C# Program

Hello guys i need your advice. How can i reverse the integer number in c# project? Please recommend some examples.


Related Discussions:- Reversing the numbers - c# program

Document type definition (dtd), What is DTD? The Document Type definiti...

What is DTD? The Document Type definition (DTD) defines how your XML should structure. For illustrate in the above XML we want to make it compulsory to provide "qty" and "total

Explain the concept of possible validation errors, Introduction to .NET Tec...

Introduction to .NET Technology 1. Explain the following with respect to .NET Technologies: a. Web Applications b. Web Server Connections 2. Write a sample program using AS

Why project needed xml?, Explain why your project needed XML. Remember ...

Explain why your project needed XML. Remember XML was meant to exchange data between the two entities as you can define your user friendly tags with ease. In the real world sce

Why the javascript validation not run on the asp.net, Why The JavaScript Va...

Why The JavaScript Validation Not Run on the Asp.Net? The Asp.Net Button Is post backed on the server & not yet Submit & when It goes to the server its states is lost so if we

Define cts, CTS(Common Type System) : In order that the two language commu...

CTS(Common Type System) : In order that the two language communicate smoothly CLR has CTS (Common Type System). Example in VB you have "Integer" and in C++ you have "long" these d

Djvu view and setup- sourcecode with nice ui, Djvu view and setup,  sourcec...

Djvu view and setup,  sourcecode with nice UI Project Description: i want an application build for viewing djvu files -must include setup -must include source code -

What is managed code and managed data, What is managed code and managed dat...

What is managed code and managed data? Managed code is code that is written to target the services of the Common Language Runtime. In order to target these services, the code m

.net components in com, How can we use .NET components in COM .NET comp...

How can we use .NET components in COM .NET components can't be used in straight forward way with the COM. You will require to create CCW in order to communicate COM components

Ewdedewdew, ssasadsdsdsddewdewdwedewdewdewededewdewdewdewdewdewdewdwedssa s...

ssasadsdsdsddewdewdwedewdewdewededewdewdewdewdewdewdewdwedssa sdedwdew dedewdew ewdewdew ewdewdew dedew ewdew ewd ewde ew ew

I need asp.net developer, I am seeking asp.net developers, and will raise d...

I am seeking asp.net developers, and will raise depends on skills and work, we are a web development firm in mexico and i want full time developers that can focus 100 percent my pr

diana

2/11/2013 8:27:25 AM

Some new learner of C# faces this type of problem. Don''t worry use this code once.

using System;  

class ReverseNumber

{

  public static void Main()

 {

   int num,rem,i,counter=0,temp;

   // num : Contains the actual number inputted via the console

   // rem : remainder of the number ''num'' when divided by 10

   // i : loop variable

   // counter : determines the no. of digits in the inputted number ''num''

   // temp : temporary variable used to save the value of ''num'' (Explained further)  

  Console.Write("Enter an integer number (Not more than 9 digits) : ");

  num = int.Parse(Console.ReadLine());    

  temp = num;

   // Here we are saving ''num'' in ''temp'' coz its value after determining the no. of digits will loose.

   // So after its work is done, ''num'' will contain value = 0

   // The value of ''num'' is resetted to its original value later from ''temp'' variable

 

 

   // Determine the no. of digits in the inputted number

   while(num > 0)

  {

   rem = num % 10;

   num = num / 10;

    if (num <= 0) 

   {

     break;

   }

    else

   {

    counter = counter + 1;

   }

  }   

  Console.WriteLine("Number of digits are = " + (counter+1));

  Console.Write("The reversed digits are : ");  

  rem = 0;

   // resetting the value of remainder ''rem''

   num = temp;

   // resetting the lost value of ''num'' from ''temp''  

   // *** Determine the reversed of inputted digits ***  

// Funda :

 // 1) Divide the number by 10 & determine the remainder. (Save the remainder in ''rem'') 

   // This will give us the last digit in the actual inputted number.   

   // 2) Write the number so obtained into the console  

   // 3) Divide the same number by 10 & get the quotient this time. 

   // Since division is between the integers, we will get the new number, deprived of the last digit.

   // Then again goto step 1) & continue until & unless the counter is equal to ''i'' (coz thats the loop varibale)  

   for(i = 0; i<=counter; i++)

  {

      rem = num % 10;

   Console.Write(rem);

   num = num / 10;   

  }    

  Console.ReadLine();  

 }

}

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd