Answer:
See explaination
Step-by-step explanation:
#input
o_t_n=int(input('Enter a string of octal digits: '))
#required variables
i = 1
dc = 0
#loop for conversion
while (o_t_n != 0):
#to find remainder
rmd = o_t_n % 10
o_t_n //= 10
dc += rmd * i
i *= 8
#print the results
print('The integer value is ',dc)
# decimalToOctal.py
#input
d_c_n=int(input('Enter a decimal integer: '))
print("Quotient Remainder Octal")
#required variables
i = 1
o_c_n = 0
num=""
#loop for conversion
while (d_c_n != 0):
#to find remainder
rm = d_c_n % 8
d_c_n //= 8
o_c_n = o_c_n + rm * i
i *= 10
num = str(rm)+num
print("%5d%8d%12s" % (d_c_n, rm, num))
#print the results
print('The octal representation is ',o_c_n)