Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

in java write a code that suppose the following input is supplied to the program: 9 Then, the output should be: 12096 (99+999+9999+999)

def mySum(k, n):
    return n * sum([ n1 * n2 for n1, n2 in zip(
        [ i + 1 for i in range(k) ],
        [ 10 ** (k - i - 1) for i in range(k) ])])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #write #code #suppose #input #supplied #output
ADD COMMENT
Topic
Name
2+7 =