What Does 'N' Represent in this Programming Question?

  • Thread starter Thread starter Iron_Brute
  • Start date Start date
  • Tags Tags
    Confusion Program
Click For Summary

Discussion Overview

The discussion revolves around the interpretation of the variable 'N' in a programming question related to finding the smallest, largest, and average values in a collection of numbers. Participants explore the meaning of 'N' in the context of programming, specifically in C#.

Discussion Character

  • Technical explanation, Conceptual clarification, Debate/contested, Homework-related

Main Points Raised

  • One participant expresses confusion about whether 'N' represents the total number of values input by the user or the individual numbers themselves.
  • Another participant suggests that 'N' refers to the entire collection of numbers and implies that the professor is not seeking a specific value for 'N', but rather a general understanding of the program's requirements.
  • A different participant argues that the question is not ambiguous and clarifies that 'N' indicates how many numbers will follow, emphasizing that the first input is not part of the list but specifies the count.
  • This participant provides examples of how the input should be structured, reinforcing their interpretation of 'N' as the count of subsequent numbers.
  • One participant later expresses gratitude for the clarification and indicates that they have successfully completed their program based on the understanding of 'N'.

Areas of Agreement / Disagreement

There is disagreement regarding the interpretation of 'N'. Some participants believe it is ambiguous, while others assert that it clearly indicates the number of subsequent inputs. The discussion does not reach a consensus on this point.

Contextual Notes

Participants express varying levels of confidence in their interpretations, and the discussion includes examples that illustrate different understandings of the problem statement.

Iron_Brute
Messages
19
Reaction score
0
I'm having a problem understanding what it is N stands for. The question is

"Write a program that will find the smallest, largest, and average values in a collection of N numbers. Get the value of N before scanning each value in the collection of N numbers."

To me it looks like N can stand for 2 different values, it could be the total number of values the user would input but it could also represent the individual numbers that the user inputs.

Im writing this in C#, and finding the smallest, largest, and average values I am fairly confident I can do that it is just what the N is supposed represent that is throwing me off.
 
Technology news on Phys.org
To me, it just looks like N is referring to the whole collection of numbers in general. I don't think your prof is looking for you to specify an actual value of N, just an idea of what to do with your program.

Welcome to cryptic programming directions 101...it has only just begun
 
"Write a program that will find the smallest, largest, and average values in a collection of N numbers"

Suppose it said:"Write a program that will find the smallest, largest, and average values in a collection of 5 numbers" or "Write a program that will find the smallest, largest, and average values in a collection of 20 numbers". Would you have a problem with that?

I disagree with carrotcake10, I don't think this is ambiguous at all. This is simply telling you the first number input will NOT be a part of the list but will tell you how many numbers are in the list. For example, you should write a program that will accept in put like
7
6
4
-3
2
12
-8
7
and output the largest and smallest numbers in that list of 7 numbers as well as their average.

or accept input like
200
11
32
-24
.
.
.
for a total of 200 numbers (NOT including the first "200") and output the smallest and largest numbers in that list as well as their average.

I would recommend something like

int N;
readln N;
for (int i= 0;i< N; i++)
{

}
 
Thanks for the help, now I understand what the N variable is supposed to be for now and I finished my programm this morning. Couldn't have done it without oy.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 35 ·
2
Replies
35
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
3
Views
2K