this code is in c++, but you might be able to find it helpful. The program reverses a number and then finds the sum of all the digits. Focus especially on the logic to reverse the number although I am pretty sure you have it.
float x;
int leftOfDecimal;
float onesDigit;
int addOnesDigit = 0;
cin>>x;
do {
leftOfDecimal = x / 10;
onesDigit = ((x/10)-leftOfDecimal);
onesDigit = (onesDigit*10);
addOnesDigit = addOnesDigit + onesDigit;
x = leftOfDecimal;
The code tags format the code properly (preserves the indenting) making it easier to read. People who post their question and use the tags will probably get more replies. It also adds the line numbers - making communication easier.
Don't worry I & many others are always asking for this.