Quote Originally Posted by christop View Post
Binary Coded Decimal (BCD) is a thing, where we "fake" storing decimal digits in an otherwise binary integer. Is this thread just an example of Decimal Coded Octal?
I'm a beginner I can't fake anything. If youcan would you tell me exactly what every line of this snippet does. I know it is part of that long function highlighted. I also know it creates 2 variables
octalnumber=0 and i=1 I also know what modulos does.
Code:
int convertDecimalToOctal(int decimalNumber){
int octalNumber = 0, i = 1;








while (decimalNumber != 0)this says while decimalNumber is not zero
do the following
{




octalNumber += (decimalNumber % 8) * i;(what this does)
decimalNumber /= 8;(what this does)
i *= 10;(what this does)
}








return octalNumber;
}