12,449,762 members (80,397 online)
Rate this:
See more:
Your next assignment is to make another modification to your average calculating program. You must now, using an array of ten grades, ask the user to input these grades, calculate the average, display the average, and then output the letter equivalent using the same number range from the last assignment.

```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Average {
class Program {
static void Main(string[] args) {

Console.WriteLine("The Average is: " + avg );
Console.WriteLine(avg);
}
}
}```
Posted 25-Oct-11 13:59pm
Updated 26-Oct-11 2:28am
Nagy Vilmos311.9K
v3
SAKryukov 25-Oct-11 20:15pm

What an abuse! You did not even take a labor of changing the sentence, so it sounds as the assignment you got: "your next assignment", "you must" (!).
This is so rude and impertinently!
People, please don't go in for such a shame, don't help this member.
--SA
RaisKazi 26-Oct-11 10:37am

Totally agree with you SA. OP should have basic decency while posting Question.
OP wrote - "Your next assignment". This sounds like a competition organized by OP.
Nagy Vilmos 26-Oct-11 8:26am

Gimmecode, homework.
RaisKazi 26-Oct-11 10:39am

My vote-1(That's the least available). At least show some basic decency while posting Question.

Rate this:

## Solution 4

As was suggested by Paul Conrad and lukeer, you need to implement a loop structure in your code. When you want to loop through something, you need to first decide how to define the loop. In this case, that would be the index of your grade array, so your loop initialization would be `int gradeIndex = 0;`. Next you require a condition for the loop to run within, that would be `gradeIndex < 10;`, and lastly you need to let the loop know how to alter the initialized variable on each loop iteration. `gradeIndex ++`.

You have an issue with your array in that you start with index 1 as your first item. In C#, arrays begin with index 0, not index 1 so your array indices should go from 0 to 9, not 1 to 10.

Within the body of your loop you need simply to put in the repeating portion of the code that is performed on each of the grade items using the gradeIndex variable in place of the hardcoded indices you have in your sample.
Rate this:

## Solution 2

```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Average
{
class Program
{
static void Main(string[] args)
{

Console.WriteLine("The Average is: " + avg );
Console.WriteLine(avg);

is what I got but I was absent for the lesson and its due 2morro

lukeer 26-Oct-11 5:12am

For the social aspect: What you posted here is not a solution, even though it is titled "Solution 2". Instead it belongs to the question.
Putting this code in the question in the first place would have caused a much more helpful reaction from forum posters.
Don't be afraid. You can still use the `Improve question` link to fix that.

For the problem:
You're right not using `grade1`, `grade2` and so on. So you don't need to declare them.
As Paul Conrad said, the input and the calculation should be done in a loop. Are you familiar with the `for(init;condition;repeat)` construct?
Member 8349150 26-Oct-11 6:07am

No sorry I am not familiar I was absent for for loops and arrays
Richard MacCutchan 26-Oct-11 7:38am

There are plenty of references in your notes, programming books, on the internet and elsewhere if you try looking.
lukeer 26-Oct-11 8:05am

Have a look at MSDN. It expains how a for-loop is used.
In your case, you would of course initiate your incrementing variable `i` to zero and loop while `i < 10` (Arrays are zero-based. The first element's index is 0. All indexes, including the last one are less than the array's item count).
Member 8349150 26-Oct-11 9:44am

I cannot even figure out where to start...can someone lead me onto what to do
Nueman 26-Oct-11 11:10am

Here is where to start: The Internet is no substitute for regular class attendance. Why did you miss the lecture on loops and arrays? Were you sick? Family emergency? Those are acceptable excuses. But if you are blowing off your lectures by doing something else during that time, it is not acceptable. Try to find a mentor in class or go to the campus computer lab. I am sure you will find people really want to help.
Learning to program requires a huge investment in time and work. It is rewarding. Hang in there and don't give up.

Top Experts
Last 24hrsThis month
 OriginalGriff 305 ppolymorphe 134 Maciej Los 133 Karthik Bangalore 130 David_Wimbley 90
 OriginalGriff 5,683 Karthik Bangalore 3,335 ppolymorphe 3,262 Maciej Los 2,872 Richard Deeming 2,695