even number sum

Nov 24, 2008 at 3:47pm
can anyone help solving this program..."write a program to sum all even numbers from 1 to 100"

thank you
Nov 24, 2008 at 4:58pm
You should do your own homework. Think about how you would do this yourself using pen and paper, then translate it into code and if you got problems, you can ask questions on this forum.
Nobody will just give you the code you need, certainly not if you're asking it the way you do (without even trying to do it yourself).
http://www.cplusplus.com/forum/articles/1295/
Nov 24, 2008 at 6:42pm
Nov 25, 2008 at 1:42pm
Well some people just can't find the info, and maybe this guy is just starting to program you never know. Either way, what you are going to need is some simple if statements using modulus (%). In case you don't know, modulus divides one number by another, except the result is the remainder. For example 9%2=1. Any even number can always be divided perfectly by two, but an odd number can never be, and theres your answer.
Last edited on Dec 4, 2008 at 6:33pm
Nov 25, 2008 at 6:33pm
@epiqu1n: No. The OP is just being lazy. There are tutorials on this site, and google has hundreds of thousands of articles on C++. This was not a question, but a request for someone to do their homework.

We do not entertain such requests.
Dec 3, 2008 at 5:46pm
Maybe Epiqu1n is just a nice guy trying to help a bud out, ever think of that big guy?
Dec 3, 2008 at 7:33pm
Being nice does not translate to giving answers (which could be considered cheating).
Dec 3, 2008 at 9:07pm
Agreed with firedraco. Epiqu1n is being nice, but the result is that the OP is just abusing that fact, and wont do his homework next time either.

When you'll read more postes like this you will understand what we mean.
Dec 4, 2008 at 2:26am
just research modulus
Last edited on Dec 5, 2008 at 1:41am
Dec 4, 2008 at 2:53am
wow belkdaddy
we have like the same screename!
we must be twins or something
Dec 4, 2008 at 6:34pm
Ok I changed it so the code isn't there even though it's probably too late, actually sorry though I didn't realize I posted the whole thing I thought there was more to it besides the if statement. But it doesn't hurt to just help them understand the concept with a short example, so that way they at least have to understand it to get it to work.
Dec 4, 2008 at 6:52pm
@epiqu1n

You dont have to feel gulty or someting. You're right that sometimes it is good to post code to show how it works, but you need to understand that there are differences between questions. Some people actually have tried to solve it themself, have done some resource and tried it again, but simply cant figure out the problem. Those people you should help as much as possible.
Other people are just being lazy, and dont want to make there homework, so they simply post there assigment and hope someone will give them the code. They havent even tried to solve it. You shouldnt help those people, cause they're not worth it.
Last edited on Dec 4, 2008 at 6:53pm
Topic archived. No new replies allowed.