English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2006-07-20 23:19:17 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

a c++ programe

2006-07-20 23:34:32 · update #1

3 answers

U havnt mentioned any language?
1.Check if the num.has more than 1 digit . If No, -re-enter
2. Say the num is A
3.divide A by 10. Store Remainder in B. & the Result R=R*10 + B
4. If A isnt 0-zero continue step 3.
5. Final ans is R

2006-07-20 23:26:27 · answer #1 · answered by daffy duck 4 · 1 0

This method lacks eleganance but will work.

1- Convert the number to a string.
2- Parse the string one char at a time to build a new string in the reverse order.
3- Convert the string back to a number.

2006-07-21 00:19:44 · answer #2 · answered by Westport 2 · 0 0

you may have to change my syntax, i haven't done this in a while
instead of 732, you can have any number you want, but keep the other two equal to 0

int orig = 732;
int rev = 0;
int temp = 0;
do
{
temp = {mod 10 of}(orig);
rev = rev*10 + temp;
orig = orig/10;
} while (orig>0);

this will work because i made them all integers
review the mod function if you need to

2006-07-21 01:19:52 · answer #3 · answered by mommy_mommy_crappypants 4 · 0 0

fedest.com, questions and answers