public int factorial(int n) { if (n == 0) return 1; else return (n * factorial(n-1)); // tail recursion } public int factorial(int n) { int product = 1; int i; for (i = n; i >= 1; i--) product = i * product; // without tail recursion return product; }
3 comments:
Hi, This is Chandrika from Chennai. I have read your blog and I got some knowledgeable information through this blog. Really useful blog. Keep update your blog.
Regards...
Java Training in Chennai
Thanks for the efforts in writing the wonderful article.
php interview questions and answers
salesforce interview questions
blue prism interview questions
javascript interview questions
ethical hacking interview questions
networking interview questions and answers
Most helpful blog! It is the greatest comprehensive updates about this topic and Thank you for your sharing with us..!
Automation Anywhere Training in Chennai
Automation Anywhere Online Training
VMware Training in Chennai
VMware Course in Bangalore
Automation Anyware Online Course
Post a Comment