You can have an average of whatever is input (assuming we are not looking at PI which I do not know as having an ending). If you press Enter or whatever method is used to cause an input into the program, then the programming language or input design of the program will interpret that information, likely perform some calculation, then give the result of the calculation.
What I mean is, you can just press enter (with no other value entered) and (depending on the programming language or design of the program) the program can interpret your value (if reading integers) as Zero. Some languages may interpret the input as a non value or nul and may output something similar to your 'NaN'.
However, in answer to your first question, the average of one thing is always that thing. Unless you can only have an average until you have two or more of something to create an average. So whatever is input, as long as it was only one input, would result in that input as being the average.
To answer your ending question, I would say the NaN is more correct because just pressing enter (assuming that is how the data is input) and is done so with the intent of at least not giving a specific value. That is the answer for the person inputting the data. The answer may also depend on the programmers intent on what type of input they are looking for --- numerical (0 may be correct) or non-numerical (Nan is correct).
Float.NaN
orDouble.NaN
overnull
. After all, my method should be returning afloat
ordouble
, andnull
can only be returned forObject
types. $\endgroup$