Friday, February 1, 2019

Sum of N series

  • Problem Description

    Python Program to Read a number n and Compute n+nn+nnn...
    Eg. if n=4, then 4+4*4+4*4*4+4*4*4*4
  • CODING ARENA
  • n=int(input())
    count=0
    for i in range(1,n+1):
        ans=n**i
        count+=ans
    print(count)
  • Test Case 1

    Input (stdin)
    5
    
    
    Expected Output
    3905
  • Test Case 2

    Input (stdin)
    6
    
    
    Expected Output
    55986

No comments:

Post a Comment