adding the individual digits in a int value

HI guys, i need to write a function which involves me taking in a int value and repeatedly adds the individual digits in the value and if the resulting value consist of more then one digit repeat the process again till the resulting value is a single digit. any idea how to write the code?

an example will :
the int value is 34567

wad i need to do is
3+4+5+6+7=25
and since 25 is not a single digit value i need to repeat it agn:
2+5=7
Hint:

number % 10 "extracts" the low digit (12345 % 10 = 5)
number / 10 drops the low digit (12345 / 10 = 1234)
Topic archived. No new replies allowed.