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.

```
# Function to convert
# octal to decimal
def octalToDecimal(n):
num = n;
dec_value = 0;
# Initializing base value
# to 1, i.e 8^0
base = 1;
temp = num;
while (temp):
# Extracting last digit
last_digit = temp % 10;
temp = int(temp / 10);
# Multiplying last digit
# with appropriate base
# value and adding it
# to dec_value
dec_value += last_digit * base;
base = base * 8;
return dec_value;
```

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.