Connecting Tech Pros Worldwide Help | Site Map

Loop count question with spoonfed answer

Newbie
 
Join Date: Nov 2009
Posts: 1
#1: 3 Weeks Ago
I've been having trouble trying to write this C Program and it's getting frustrating because I come close every time with no good results! How do I write a C Program whose output looks like the following:


100 102 104 106 108 110
112 114 116 118 120 122
124 126 128 130 132 134
136 138 140 142 144 146
148 150

-2.3 -1.9 -1.5 -1.1 -0.7 -0.3 0.1 0.5 0.9 1.3 1.7 2.1 2.5 2.9
Sum of negative values: -7.8
Sum of positive values: 12

1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
5 10 15 20 25 30 35 40 45 50
6 12 18 24 30 36 42 48 54 60
7 14 21 28 35 42 49 56 63 70
8 16 24 32 40 48 56 64 72 80
9 18 27 36 45 54 63 72 81 90
10 20 30 40 50 60 70 80 90 100
Expert
 
Join Date: Mar 2008
Location: Naperville, Illinois U.S.
Posts: 830
#2: 3 Weeks Ago

re: Loop count question with spoonfed answer


What went wrong with your last try?
Newbie
 
Join Date: Nov 2009
Posts: 20
#3: 3 Weeks Ago

re: Loop count question with spoonfed answer


I am not quite sure what it is you are trying to do, but here's what I would do:

Expand|Select|Wrap|Line Numbers
  1. <snipped>
  2.  
But I assume your code has more meaning than this simple exercise in loops. We need more information to help you.

Edit: I apologize if that was, indeed, what you were looking for, in which case I just spoonfed.
Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Posts: 5,366
#4: 3 Weeks Ago

re: Loop count question with spoonfed answer


Quote:

Originally Posted by Ectara

Edit: I apologize if that was, indeed, what you were looking for, in which case I just spoonfed.

Yes, you can tell you are spoonfeeding when you write code rather than explain what to do.
Newbie
 
Join Date: Nov 2009
Posts: 20
#5: 3 Weeks Ago

re: Loop count question with spoonfed answer


Fair enough, fair enough. I'll be sure to keep that in mind for next time. If the OP has another question, or a clarification, I'd be glad to help out.

Though, it did say "like" the following, not the exact output shown, so maybe the question still needs an answer.

Quote:

Originally Posted by clayman View Post

<snip>
How do I write a C Program whose output looks like the following:
<snip>

Reply