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

Implementing page fragment caching, How will you implement Page Fragment Ca...

How will you implement Page Fragment Caching? The Page fragment caching includes the caching of a fragment of the page, rather than the whole page. When the parts of the page a

Package forwarding website design and develop, Project Description: We w...

Project Description: We want to prepare a package forwarding website. Package forwarding refers to a service where US forwarder provides International shoppers with a US address

A crm based on .net and oracle as backend, A CRM based on .net and Oracle a...

A CRM based on .net and Oracle as backend with import data, Transaction Reporting and management Capabilities Project Description: 1. Introduction ADA recovery Branch gets

Describe how global application file differs from web.config, Question: ...

Question: (a) Explain the function of the main .NET data objects: Connection, Command, DataReader, DataAdapter, DataSet, DataTableCollection, and DataView. (b) Describe h

Explain system workflow and a human workflow, What is the difference amonga...

What is the difference amonga system workflow and a human workflow? A system workflow is a workflow that is developed to automate interactions between applications. Such workfl

Connect my marketplace website with stripe/connect, Project Description: ...

Project Description: I am trying to connect my marketplace website with Stripe/connect. I have 5 or 6 scripts already written that just need to be adjusted so they will work: 2

I need a full time .net coder, Full Time Coder My colleague is seeking f...

Full Time Coder My colleague is seeking for someone to work on his website via team viewer. First I would need scale following skills- a) C# - b) AJAX - c) LINQ to S

Configure webgarden, How do we configure "WebGarden"? The process model...

How do we configure "WebGarden"? The process model configured the "Web garden" settings in the "machine.config" or in the "Web.config" file. The configuration section is named

Uddi, What is UDDI? The Full form of the UDDI is Universal Description,...

What is UDDI? The Full form of the UDDI is Universal Description, Discovery and Integration. The directory that can be used to publish and discover public Web Services. If you

I need asp.net print page task, I need asp.net print page task Project D...

I need asp.net print page task Project Description: I have a little task on asp.net, I need to print a text data to receipt printer from web page, I used the subsequent code

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