5 Replies - 532 Views - Last Post: 04 August 2012 - 02:43 AM Rate Topic: -----

#1 Untalented  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 136
  • Joined: 31-January 12

Sequence Problem

Posted 04 August 2012 - 02:25 AM

Deleted

This post has been edited by Untalented: 04 August 2012 - 02:35 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Sequence Problem

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1770
  • View blog
  • Posts: 3,429
  • Joined: 30-May 10

Re: Sequence Problem

Posted 04 August 2012 - 02:30 AM

1+1=2
2+2=4
3+4=7
4+7=11
5+11=16

Perhaps pass two parameters to sum, where one parameter increments (as you do now), and the other is the sum so far (those now colour coded above).
Was This Post Helpful? 1
  • +
  • -

#3 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,473
  • Joined: 05-May 12

Re: Sequence Problem

Posted 04 August 2012 - 02:34 AM

On line 19, you have y = z + z; which is equivalent to y = x + x; Why not make sum() take two parameters: x and lastY, and change that line to something like y = x + lastY; ?
Was This Post Helpful? 1
  • +
  • -

#4 Untalented  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 136
  • Joined: 31-January 12

Re: Sequence Problem

Posted 04 August 2012 - 02:35 AM

Thanks :rolleyes:
Was This Post Helpful? 1
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6110
  • View blog
  • Posts: 23,667
  • Joined: 23-August 08

Re: Sequence Problem

Posted 04 August 2012 - 02:38 AM

Do NOT delete your original post! That's just rude.
Was This Post Helpful? 3
  • +
  • -

#6 Untalented  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 136
  • Joined: 31-January 12

Re: Sequence Problem

Posted 04 August 2012 - 02:43 AM

View PostJackOfAllTrades, on 04 August 2012 - 02:38 AM, said:

Do NOT delete your original post! That's just rude.


Sorry, someone might laugh and criticize my codes thats why i deleted it :hang:

Thank you

Skydiver and Salem_c
Was This Post Helpful? -1
  • +
  • -

Page 1 of 1