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

Implement dtc in .net, How to implement DTC in .NET DTC is implemented ...

How to implement DTC in .NET DTC is implemented using the COM+. Following are some of the steps to implement COM + in .NET:- 1) The "EnterpriseService" namespace has all

Gmail, how make the google sign up page?

how make the google sign up page?

What is windows workflow foundation, What is Windows Workflow Foundation (W...

What is Windows Workflow Foundation (WF)? Windows Workflow Foundation (WF) is a technology that was first introduced in .NET Framework 3.0. WF having of a programming model, a

A super-hero sharepoint developer with great design skills, A Super-hero Sh...

A Super-hero SharePoint developer with great design skills Project Description: US: Our start-up company prepares a very innovative and cool SharePoint related product with c

Explain image generator (ngen.exe), Image Generator (Ngen.exe) The Ngen...

Image Generator (Ngen.exe) The Ngen.exe (Native Image Generator) allows you to run the JIT compiler on your assembly's MSIL and generate native machine code which is cached to

Explain nutritional properties of processing food, Nutritional properties o...

Nutritional properties of Processing food Processing food, you may have realized that many desirable changes occur, which include development of pleasing colours and flavors, i

Cache callback, What is Cache Callback? The Cache object is dependent o...

What is Cache Callback? The Cache object is dependent on its dependencies for example time based, file based, etc...The Cache items remove the object when cache dependencies ch

I need automatic rate processing, Project Description: PURPOSE Xconne...

Project Description: PURPOSE Xconnect needs a fully automated system for receiving and processing Terminator cost sheets based on set business principle, convert the accepted

What are runtime services, What are runtime services? Runtime services ...

What are runtime services? Runtime services having of predefined and user-defined classes that are available to the workflow runtime engine during implementation to customize t

Add in bitcoin payment option in website, Add in bitcoin payment option in ...

Add in bitcoin payment option in website Project Description: Include bitcoin files to magento for payment options on website. It is just including the files to the magent

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