What are you entering for your data?
What are you entering for your data?
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Maybe you need to invert -2682.00000. Like, maybe the answer is 2682.00000.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
With printf, this is unnecessary and in C89 actually undefined behavior.Originally Posted by dwks
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Code:grasqyd = yarea - harea;Code:I made the change but I'm still getting -2682.00000 seconds for an answer.
here
in any case if harea is greater than yarea, obviously ur result is going to be negative .
that is the reason why ur getting answer in negative.
Last edited by prasath; 09-19-2005 at 05:53 AM.
What do I need to change to correct this negative result? I entered %6.2lf in the result but I don't think it will work.
To answer the previous question, I enter values such as:Code:("The time required to cut the grass at a rate of two square feet a\n" "second is %6.2lf.\n",time);
Code:Enter the length of the yard in feet (eg.20):35 Enter the width of the yard in feet (eg.20):20 Enter the length of the house in feet (eg.20):16 Enter the width of the house in feet (eg.20):13
Just check which one is greater and find out the difference accordingly.this solves the negative problem
Code:yarea>harea ? (grasqyd = yarea - harea) : (grasqyd = harea - yarea);