Octal to decimal conversion

    0

    0

    CrypticSai-08

    def OctalToDecimal(num):
        decimal_value = 0
        base = 1
        while num:
            last_digit = num % 10
            num = int(num / 10)
            decimal_value += last_digit * base
            base = base * 8
        return decimal_value
    octal = 512
    print("The decimal value of",octal, " is",OctalToDecimal(octal))
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.