Count Digits

    0

    0

    Mahendra Kumar

    beginnerbasicMathslogic

    Count the number of digits in a given number

    # take input
    num = int(input('Enter any number: '))
    # count number of digits
    count = 0
    while (num>0):
        num = num//10
        count = count+1
    # printing number of digits
    print('Number of digits:', count)
    
    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.