944,085 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1756
  • C RSS
Mar 2nd, 2005
0

summation

Expand Post »
how do i do summation of n+sin(n) without A while loop, only for?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Crazyike is offline Offline
1 posts
since Mar 2005
Mar 2nd, 2005
0

Re: summation

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?
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Mar 3rd, 2005
0

Re: summation

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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Multiple output Handles
Next Thread in C Forum Timeline: Using binary operators!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC