Re: ASSIGNMENT
- From: Lew Pitcher <lpitcher@xxxxxxxxxxxx>
- Date: Fri, 24 Apr 2009 09:53:24 -0400
On April 24, 2009 09:46, in comp.lang.c, Mark Bluemel
(mark_bluemel@xxxxxxxxx) wrote:
Lew Pitcher wrote:
On April 24, 2009 08:56, in comp.lang.c, azom47@xxxxxxxxx...
(azom47@xxxxxxxxx) wrote:
COULD YOU PLEASE SOLVE THE FOLLOWING QUESTION.
WRITE A PROGRAM IN C THAT WILL CALCULATE THE SUM OF EVEN NUMBERS FROM
0 TO 20?
We are not a "homework help line", but if you post what you've done soThink about mathematics. What have you learnt about sums of series (have
far, we can help you by making suggestions as to how to fix what you've
done.
/I/ will go further than that, though. I will tell you how to write the
program you've asked us about.
First off, don't even think of C.
you learnt anything about them)? Can you apply this to the problem in
hand?
Hint: If it were all the even numbers from 2 to 10,000,000 you wouldn't
even consider doing individual addition would you?
Of course.
OTOH, an obvious simple homework problem, and an OP who cant solve it,
points to a "beginners" course in C. Homework is given for a reason, and a
C-language homework problem of such a simple nature isn't likely meant to
teach how to apply lateral thinking to mathematical problems. Instead, it
is likely to be re-enforcing the basics of the C language.
So, a lateral reinterpretation of the mathematics could be the solution to
the problem as stated. But then again, so could a simple for() loop which
constructs the solution using simple arithmetic. And the for() loop is more
likely to be what the homework is all about, don't you think?
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
.
- Follow-Ups:
- Re: ASSIGNMENT
- From: Mark Bluemel
- Re: ASSIGNMENT
- References:
- ASSIGNMENT
- From: azom47
- Re: ASSIGNMENT
- From: Lew Pitcher
- Re: ASSIGNMENT
- From: Mark Bluemel
- ASSIGNMENT
- Prev by Date: Re: ASSIGNMENT
- Next by Date: Re: ASSIGNMENT
- Previous by thread: Re: ASSIGNMENT
- Next by thread: Re: ASSIGNMENT
- Index(es):
Relevant Pages
|