summation

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 1
Reputation: Crazyike is an unknown quantity at this point 
Solved Threads: 0
Crazyike Crazyike is offline Offline
Newbie Poster

summation

 
0
  #1
Mar 2nd, 2005
how do i do summation of n+sin(n) without A while loop, only for?
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,362
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 241
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: summation

 
0
  #2
Mar 2nd, 2005
Why not post the code of how you'd do it with a while loop? Then maybe your best attempt at converting it to a for loop?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,698
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 728
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: summation

 
0
  #3
Mar 3rd, 2005
All of the parts of a for loop are optional. For example, to write an infinite loop you might do this:
  1. for ( ; ; ) {
  2. /* Stuff */
  3. }
Converting a while loop to a for loop is trivial with that little tidbit. Of course, there are other ways, but they require restructuring the loop a bit.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC