Python program to convert octal to decimal using function

0
7
def octal_to_dec(n): # Function which is convert octal to decimal
    num = n; 
    dec_value = 0; 
    base = 1;         # Initializing base value i.e 8^0
    temp = num; 
    while (temp): 
      last_digit = temp % 10; 
      temp = int(temp / 10); 
      dec_value += last_digit * base; 
      base = base * 8; 
    return dec_value; 
#_____main______ 
octal_num=int(input("Please enter an octal (0 to 7) number: ")) 
print(octal_to_dec(octal_num));

    Output 1:
            Please enter an octal (0 to 7) number: 59
            49
    Output 2:
            Please enter an octal (0 to 7) number: 432
            282
    Output 3:
           Please enter an octal (0 to 7) number: 25457
           11055

इन्हें भी देखें।

Python Programs के लिये यहाँ click करें।

 

 

 

 

Python program to convert octal to decimal using function program to convert octal to decimal using function in python write a program to convert octal to decimal using function in python write a python program to convert octal to decimal using function Python program to convert octal to decimal program to convert octal to decimal program to convert octal to decimal in python write a program to convert octal to decimal program to convert octal to decimal in python convert octal to decimal in python convert octal to decimal program convert octal to decimal program in python octal to decimal program octal to decimal program in python python program to convert octal to decimal using functions python program to convert octal to decimal number write a program to convert octal to decimal write a program to convert octal to decimal in python write a python program to convert octal to decimal python code to convert octal to decimal python program to convert octal number into decimal number program for converting octal to decimal in python python program to convert from octal to decimal number python program for converting octal to decimal program to convert octal number to decimal number in python write a python program to convert octal number to decimal number how to convert octal to decimal in python program for octal to decimal conversion in python

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here