Re: ASSIGNMENT



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 so
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.

Think about mathematics. What have you learnt about sums of series (have
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. ------


.



Relevant Pages

  • Re: ASSIGNMENT
    ... WRITE A PROGRAM IN C THAT WILL CALCULATE THE SUM OF EVEN NUMBERS FROM ... OTOH, an obvious simple homework problem, and an OP who cant solve it, ... a lateral reinterpretation of the mathematics could be the solution ... so could a simple forloop ...
    (comp.lang.c)
  • Re: ASSIGNMENT
    ... WRITE A PROGRAM IN C THAT WILL CALCULATE THE SUM OF EVEN NUMBERS FROM ... C-language homework problem of such a simple nature isn't likely meant to ... a lateral reinterpretation of the mathematics could be the solution to ... And the forloop is more ...
    (comp.lang.c)
  • Das Kalenderblatt 111223
    ... In a mathematics, where these inequalities are wrong, my proofs ... Those inequalities do not hold in mathematics unless the left ... You have not defined what you mean by sum of infinitely many ... That is an entirely different form of 'continuity' than the ...
    (de.sci.mathematik)
  • Re: Aspiring highest-order programmer
    ... > Don't be mistaken by the term 'sum', ... with a deviant community. ... mathematics at most droll and developing software for polynomial ... language use is continuous ...
    (comp.programming)
  • Re: ** says: Definition: sum{i in N} i = 0
    ... >> This is NOT a sum. ... > If a positive sequence has no ... In mathematics, ... Mathematics yields for infinite trees, ...
    (sci.math)