Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. yuriythebest2

    recursion question

    hi! I need to find the sum of all positive numbers up to N, with the step of D, for instance id D=3 and N=11 then 11+8+5+2=26. Currently my way is like so: sum(N, D, Res) :- D<N, N1 is N - D, sum(N1, D, Res1), Res is Res1+N1. however this yields the answer 17 which is incorrect please help!

Part and Inventory Search

Back
Top