Find the sum of number of series after dividing the element of array from previous element.
Input : 3 7 9 10 12 18 Explanation: 3 + 7/3 + 9/7 + 10/9 + 12/10 + 18/12 = 9 (taking only integer part) Output : 9 Input : 1 12 24 30 60 Output : 18
Approach: We take elements in an array and divide the element from previous element. We do this process for all the elements of an array except very first element. Add the result after division and very first element.
Note: If any element is zero in an array then it fails to do the task and return minus one.
- Given an array A and a number x, check for pair in A with sum as x
- Ugly Numbers
- Search an element in a sorted and rotated array
- Merge an array of size n into another array of size m+n
- k largest(or smallest) elements in an array | added Min Heap method
- Program for array rotation
- Write a program to reverse an array or string
- Reversal algorithm for array rotation
- Block swap algorithm for array rotation
- Leaders in an array
- Count Inversions in an array | Set 1 (Using Merge Sort)
- Find the smallest and second smallest elements in an array
- Maximum and minimum of an array using minimum number of comparisons
- Check for Majority Element in a sorted array
- Segregate 0s and 1s in an array
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nitin mittal