I'm a beginner at c++ and i was given a certain assignment. A person enters a digit, and then this digit is multiplied by 4, but if the multiplied number is greater than 9 then we add its digits, and if the addition still give you greater than nine, then we continue to add until it gives us something equal to or less than 9. for example:

cin >> 9;

9 * 4 = 36;

since 36 > 9;

then do 3 + 6 = 9.

I don't know how to write it. Any help is appreciate it and please keep it simple since I am just a beginner.