Best Math Formula website. Search anything about Math Formula in this website.
how to write a non recursive formula. A numbervalue in a sequence is called a term of the sequence. When n is equal to 0 the if condition fails and the else part is executed returning the sum of integers ultimately to the main function.
Try to write an iterative algorithm for TOH. We can write such codes also iteratively with the help of a stack data structure. When n is equal to 0 the if condition fails and the else part is executed returning the sum of integers ultimately to the main function.
When n is equal to 0 the if condition fails and the else part is executed returning the sum of integers ultimately to the main function.
Using the recursive formula we would have to know the first 49 terms in order to find the 50 th. Your work is fine. Initially the sum is called from the main function with number passed as an argument. This process continues until n is equal to 0.