answersLogoWhite

0

int RevNum( int num )

{

const int base = 10;

int result = 0;

int remain = 0;

do

{

remain = num % base;

result *= base;

result += remain;

} while( num /= base);

return( result );

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

How do you convert a number that consist of alphabet and number in reverse order?

To reverse a number, first convert the number to a string, then reverse the string. Given your number consists of alphanumeric characters, the number must already be a string so simply reverse the string: #include<string> using std::string; string reverse (const string& s) { string str {}; for (auto c : s) str.insert (str.begin(), c); return str; } int main () { std::cout << "Enter a number: "; string s {}; std::cin >> s; std::cout << "The number in reverse is: " << reverse (s); }


Write a Program for reverse of number using pointer?

void main(){int *n,a,r=0;clrscr();printf("enter any no to get its reverse: ");scanf("%d",&*n);while(*n>=1){a=*n%10;r=r*10+a;*n=*n/10;}printf("reverse=%d",r);getch();}Output:enter any no to get its reverse: 456reverse=654


Program to find reverse of given number using pointers?

#include #include void main() { int rev num=0; while(num>0) { rev num=rev num*10+num%10; num=num%10; } return rev_num; } int main(); { int num=4562; printf("reverse of number is%d",reverse digit(num)); getch(); return o; }


C code on Reversing integer array elements using temporary variable?

#include <stdio.h> int main() { int number, temp; printf("enter the number"); scanf("%d",&number); printf("\n reverse of %d",number); while(number>0) { temp=temp*10+number%10; number=number/10; } printf(" is %d",temp); }


How do you write a c program to convert binary to decimal by using while statement?

write a c++ program to convert binary number to decimal number by using while statement

Related Questions

What are the steps for using a free reverse phone number lookup?

The steps for using a free reverse phone number lookup are: go to a website like Reverse Number Direct, type in the relevant information and then you'll get results.


How do you write a C program to reverse the 3 digits of a number using while loop?

unsigned reverse (unsigned num) { unsigned rev = 0; while (num) { rev *= 10; rev += num % 10; num /= 10; } return rev; }


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); }


Design an algorithm to find a reverse of number?

An example of an algorithm that will reverse a number is written as such, digit reverse(num), while (num>0) then, digit =num%10. This particular algorithm divides a number by 10 until the original number from the LSD is found.


What benefit can using a reverse search phone number have?

When using a reverse search phone number the person you are calling can tell who you are without having to look you up manually, this will increase the chances of calls from reputable companies being answered.


How do you convert a number that consist of alphabet and number in reverse order?

To reverse a number, first convert the number to a string, then reverse the string. Given your number consists of alphanumeric characters, the number must already be a string so simply reverse the string: #include<string> using std::string; string reverse (const string& s) { string str {}; for (auto c : s) str.insert (str.begin(), c); return str; } int main () { std::cout << "Enter a number: "; string s {}; std::cin >> s; std::cout << "The number in reverse is: " << reverse (s); }


Write a Program for reverse of number using pointer?

void main(){int *n,a,r=0;clrscr();printf("enter any no to get its reverse: ");scanf("%d",&*n);while(*n>=1){a=*n%10;r=r*10+a;*n=*n/10;}printf("reverse=%d",r);getch();}Output:enter any no to get its reverse: 456reverse=654


Program to find reverse of given number using pointers?

#include #include void main() { int rev num=0; while(num>0) { rev num=rev num*10+num%10; num=num%10; } return rev_num; } int main(); { int num=4562; printf("reverse of number is%d",reverse digit(num)); getch(); return o; }


How do you know that a numeric is palindrome or not using c or pascal language?

Reverse the digits then check of the new number is the same as the original number.


Find person by mobile number 9868777853?

Try using a reverse phone search like on whitepages.com or searching the number on Google


How and where should I go to complete a reverse phone number look up?

You can check this website http://www.whitepages.com/reverse_phone By using this website you have to look for the tab reverse phone then put the phone number and click find.


Is it possible to reverse the amount of protons and electrons in an atom?

The number of protons can not be changed in an atom, while the number of electrons can be.