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

Explain dataset accept changes, Explain Dataset Accept Changes and Data Ada...

Explain Dataset Accept Changes and Data Adapter Update methods?  Data Adapter Update method Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated

Use a checkbox in a datagrid, How to use a checkbox in a datagrid? The ...

How to use a checkbox in a datagrid? The steps to be done are as follows:- 1)    In the ASPX page you have to add Itemtemplate tag in datagrid. 2) I

What are the different implementations of linq, What are the different impl...

What are the different implementations of LINQ? The different implementations of LINQ are: LINQ to SQL - Refers to a component of.NET Framework version 3.5 that provides a

Hardware monitor tool in visual basic, Hardware Monitor Tool in Visual Basi...

Hardware Monitor Tool in Visual Basic Project Description: Hi, seeking a developer who is experienced in Visual Basic 10 Or Visual Basic 13 and will develop an application li

What is reflection, What is Reflection?  It extends the advantages of m...

What is Reflection?  It extends the advantages of metadata by allowing developers to inspect and use it at runtime. For example, dynamically determine all the classes contained

Want microsoft crm dynamics crm 2011 or 2013 programmer, Want Microsoft CRM...

Want Microsoft CRM Dynamics CRM 2011 or 2013 programmer Project Description: Need to do customizations in CRM itself and integrate CRM 2011 with SAP Business One and HTML web

Dcom, What is DCOM? DCOM is different from COM in that it allows for cr...

What is DCOM? DCOM is different from COM in that it allows for creating objects distributed around  a network, and a protocol for invoking that object's methods, & secures the

What is the use of dataview, What is the use of DataView? User-defined ...

What is the use of DataView? User-defined view of a table is contained in a DataView. A complete table or a small section of table depending on some criteria can be shown by an

Post cache substitution, What is Post Cache substitution? The Post cach...

What is Post Cache substitution? The Post cache substitution is used when we want to cache the complete page but also require some of the dynamic region inside that cached page

Differences between the detailsview and formview controls, Question: (a...

Question: (a) Give three key differences between the DetailsView and FormView controls. (b) The ASP.NET 2.0 Framework introduces the idea of validation groups. How Valida

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