answersLogoWhite

0

C plus plus program to reverse the digits of a number?

Updated: 8/17/2019
User Avatar

Wiki User

11y ago

Best Answer

int RevNum( int num )

{

const int base = 10;

int result = 0;

do

{

result *= base;

result += num % base;

} while( num /= base);

return( result );

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C plus plus program to reverse the digits of a number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How you write a program in c plus plus to print plaindromic numbers from 1 to n?

To check if a number is a palindrome, reverse the number and see if it is equal to the original number. If so, the number is a palindrome, otherwise it is not. To reverse a number, use the following function: int reverse(int num, int base=10) { int reverse=0; while( num ) { reverse*=base; reverse+=num%base; num/=base; } return(reverse); }


C plus plus program to print sum of uppercase digits?

Good luck. I don't think it is possible, since there is no such thing called upper case digits.


How do you check whether any number is palindrome or not in c plus plus?

To check if a given number is palindromic, reverse its digits and see if the result has the same value ... This only works for positive numbersint isPalindrome (unsigned int N) {unsigned int R; /* the reversed version of that number */for (R = 0; N != 0; R = R*10 + N%10, N = int (N/10)); /* reverse digits */if (N == R) then return 1 else return 0;}


How many digits are there in a phone number in Russia?

Telephone numbers throughout Russia are uniformly 3 digits for the area code plus 7 digits for the local number.


What is the Aram strong number in c plus plus?

If the sum of squares of digits of a number equals to the number itself, then that number is called an aram strong number.


C plus plus program to print number patterns?

bghjg


What number is this plus 88213300237?

The first two digits indicate it's a number for either Taiwan or Bangladesh.


Who has number plus 18098517312?

Answers.com is not a reverse directory enquiry service!


A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999


The smallest two digits number plus the biggest two digits number is?

The smallest two digit number is 00 (a number used as a wire gauge) and the biggest is 99, so the sum of the biggest and smallest 2-digits numbers is 99 (99 + 00).


What is the maximum number represents by 16 bit signed binary digits?

Plus or minus 65,535


Where is this phone from plus 494142907529?

The first two digits (49) suggest a number in Germany. HOWEVER - there is no area code starting with the next three digits (414),