What Does 'N' Represent in this Programming Question?

In summary, the question is asking for a program to find the smallest, largest, and average values in a list of 5 numbers. The program should accept input like 7, 6, 4, -3, 2, 12, -8, 7, and output the largest and smallest numbers in that list as well as their average.
  • #1
Iron_Brute
19
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
  • #2
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
 
  • #3
"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++)
{

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

FAQ: What Does 'N' Represent in this Programming Question?

1. What is "Program question confusion"?

"Program question confusion" refers to a situation where there is a lack of clarity or understanding surrounding a specific question or problem related to a program or software. It can occur due to factors such as unclear instructions, complex programming language, or incomplete knowledge about the program.

2. How can program question confusion be avoided?

To avoid program question confusion, it is important to ensure that all instructions and requirements for the program are clearly defined and understood. It can also be helpful to break down complex problems into smaller, more manageable tasks and to seek clarification if needed.

3. Why is program question confusion a problem?

Program question confusion can lead to errors and delays in completing a project or task. It can also cause frustration and hinder the progress of a team working on a program. Additionally, it can result in a program not functioning as intended, which can have negative consequences for end-users.

4. What are some strategies for overcoming program question confusion?

One strategy for overcoming program question confusion is to approach the problem from different perspectives and to brainstorm potential solutions. It can also be helpful to seek guidance from more experienced programmers or to conduct research on similar programs or problems. Additionally, taking breaks and coming back to the problem with a fresh mind can often lead to new insights.

5. How can program question confusion impact the overall success of a project?

Program question confusion can significantly impact the success of a project. It can lead to delays, errors, and rework, which can increase the project's timeline and cost. It can also affect team dynamics and morale, as well as the quality and functionality of the final program. Therefore, it is important to address and resolve any confusion as soon as it arises to ensure the project's success.

Similar threads

Replies
4
Views
2K
Replies
2
Views
1K
Replies
8
Views
2K
Replies
35
Views
3K
Replies
19
Views
1K
Replies
4
Views
2K
Back
Top