954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

summation

how do i do summation of n+sin(n) without A while loop, only for?

Crazyike
Newbie Poster
1 post since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

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?

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

All of the parts of a for loop are optional. For example, to write an infinite loop you might do this:

for ( ; ; ) {
  /* Stuff */
}

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.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You