Search This Blog
Available Codings for Programming of C, C++, PYTHON, JAVA and HTML.
Welcome to Coding 4 Programming
- Get link
- X
- Other Apps
Labels
Sum of Natural N number | Recursion Function | Python
To find Sum of First N Number in Python Using Recursion Function.
- def sumf(n):
- if(n>0):
- return n+sumf(n-1)
- else:
- return n
- n=int(input("Enter Number="))
- sm=sumf(n)
- print("Sum of",n,"Natural Numbers is",sm)
Snapshot:
- If you have any problem related to this program. Please do comment your Problem or Mail us.
- For illustrating the any concept you can comment by line number.
- Thank you! For more programs do regular visit to Coding 4 Programming.
- Get link
- X
- Other Apps
Labels:
Python
Popular Posts
To Check Prime Number | For Loop | Python
- Get link
- X
- Other Apps
To Check Perfect Number | Function | For Loop | Python
- Get link
- X
- Other Apps
Comments
Post a Comment