Explore
ProGrad Programs
Placement Prep
TCS Codevita
Live Placement Training
Webinars
About Us

Edit
Reply




Edit

Find the sum of natural numbers with and without recursion | FACE Prep

Published on 09 Mar 2020

Program to find the sum of natural numbers with and without recursion is discussed in this article. A number, N is obtained as input and the sum of first N natural numbers is given as output.


Program to find the sum of natural numbers without using recursion


C
C++
Java
Python 3

Output
Input- Enter the number:6 Output- Sum of 6 Natural Numbers 21


Time Complexity: O(n)


Program to find the sum of natural numbers using recursion


C
C++
Java
Python 3

Output
Input- Enter the number:6 Output- Sum of 6 Natural Numbers 21


Time Complexity: O(n)


Recommended Programs








If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in