Have a look here: Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6) .
]. And don't repost a question to which you already received a perfectly good answer.
Someone seems to have had the same homework to do as you
. Look at Griff's answer, he already showed you which steps to take.
Get to work already!