Explain recursion with an example.
Answer / nashiinformaticssolutions
o Recursion is a technique where a function calls itself to solve smaller sub-problems.
8. def factorial(n):
9. if n == 1:
10. return 1
11. else:
12. return n * factorial(n - 1)
13. print(factorial(5)) # Output: 120
| Is This Answer Correct ? | 0 Yes | 0 No |
Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)
How should a programmer decide whether to use a macro or a subroutine to accomplish a given logical function
1 Answers R V College of Engineering, University of Jordan,
why you have to became a software developer?
shall we execute our java programmes in jre
Crystal report proffessional 9 to filter the issue date!!
How to print a name "ARCHANA" in any programming language
can u send some model papers how computer awareness questions are asked in goverment jobs(oriental insurance)to my mail id me.priyankapadma@rediff.com
What is the difference between windows 98/2000/XP Operating Systems?
16 Answers CMS, Siemens, TCS,
is it possible to learn sap from book without any tutorial. if yes please mention the beginner,s book of sap and also make your valuable advice for self study of sap .
Which method protects back button to retrieve old value from previous page in Struts.
what is difference between java and c#
without selecting individually each field in Action Class from jsp,what is the best process to select as many as field at a time automatically from jsp page by using value object class.