Search:

Type: Posts; User: laserlight

Search: Search took 0.21 seconds.

  1. Replies
    11
    Views
    2,738

    No, you read into num exactly once, even if -1...

    No, you read into num exactly once, even if -1 was not the first input.


    Your requirements state:
    Write a C program to read positive integers, until the value -1 is read and print the average of...
  2. Replies
    11
    Views
    2,738

    You shouldn't "fix" the value of num. Rather, you...

    You shouldn't "fix" the value of num. Rather, you should be reading into num in the body of the loop, exiting the loop when -1 is read.
  3. Replies
    11
    Views
    2,738

    Your loop condition is wrong. Actually, the...

    Your loop condition is wrong. Actually, the choice of a for loop is inappropriate here; use a while loop (or do while loop) instead.
Results 1 to 3 of 3