Hey guys, I wanted to create a program that will read an integer and display the sum of the digits of the integer, if the sum of the digits of the integer is more than 9 then the sum of the digits of that number will be calculated as well. This is done until the answer becomes an integer that is between 1 to 9. Don't mind the mechanism if it is confusing to understand, the problem is with the last if statement, I cannot seem to get the right output.
Specifically the wrong part of the code is
int remainder, remainder2, remainder3, sum=0, sum2=0, sum3=0;
printf("%d \n", sum);
printf("%d \n", sum2);
printf("%d \n", sum3);
Printing out all the different sums works as I want it to, the If statement logic does not work at all in the part mentioned above.
I really appreciate your help guys, this problem has been a pain in the ass for the past 3 days.