just started programming and encountered a beginner level loop problem today. this is what the input and output must look like
4 3.0 2.5 6.0 4.5 [enter]
5 6.0 2.5 3.4 3.0 5.6 [enter]
2 4.0 4.6[enter]
4 4.1 4.3
the first number in each row of inputs represent the number of values that should be read. for example on the first row, the first number is 4. hence the user enters 4 and then enters 4 values (3.0, 2.5, 6.0 and 4.5) after that. The same goes for 5 and 2. when the user enters 0 the program terminates and prints the output. The output represents the average of the values entered. for example, for the first row of 4 inputs, the average is 4.
I could have used a simple "while" or "for" loop with a scanf statement inside if the user enters something like this.
since its all supposed to be in the same line, is there anything about scanf that enables the user to key everything in the same line just as the problem requires?