Loop count question with spoonfed answer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • clayman
    New Member
    • Nov 2009
    • 1

    Loop count question with spoonfed answer

    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
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    What went wrong with your last try?

    Comment

    • Ectara
      New Member
      • Nov 2009
      • 24

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

      Code:
      <snipped>
      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.
      Last edited by Banfa; Nov 2 '09, 10:18 PM. Reason: Removed spoon feeding code

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        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.

        Comment

        • Ectara
          New Member
          • Nov 2009
          • 24

          #5
          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.

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

          Comment

          Working...