Octal to Decimal conversion:
I would take an example to show you this:
Octal number: 123
multiply the digit at hundredths place with 8^2
multiply the digit at tenths place with 8^1
and multiply the digit at zeroth place with 8^0
and add all of them 64*1+8*2+1*3 = 83.
num = n;
dec_value = 0;
base = 1;
temp = num;
last_digit = temp % 10;
temp = int(temp / 10);
dec_value += last_digit * base;
base = base * 8;
I am also attaching the code but It uses functions. i would recommend you to refer it once you have tried it and also try this by simple loops or so. Later I would also try to share that approach.