| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Array
Hi ,
I want to multiply the fisrt N elements of an 1D array(size 20). I though it was be easy but once I tried I could get it done. Please can someone suggest me an algorithm? I need to do it using recursion. Thank you B |
|
#2
|
|||
|
|||
|
here's an algorithm:
Code:
function with parameters array, N, counter, total (the function should be called from main() or wherever with counter and total passed as 0) if counter < N then call function again with counter+1 and total*array[N] else return total |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|