Friday, February 1, 2019

Natural Numbers

  • Problem Description

    Python Program to Find the Sum of First N Natural Numbers

    Input 

    Value of "N"

    Output
    Print the Sum of N natural Numbers

  • CODING ARENA
  • m=int(input())
    sum1=0
    while(m>0):
        sum1=sum1+m
        m=m-1
    print(sum1)
  • Test Case 1

    Input (stdin)
    18
    
    
    Expected Output
    171
  • Test Case 2

    Input (stdin)
    167
    
    
    Expected Output
    14028

No comments:

Post a Comment