Finished Module 2. Learning the C# Syntax
This commit is contained in:
parent
3a84b1d059
commit
bafaa1b11e
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace GradeBook
|
namespace GradeBook
|
||||||
{
|
{
|
||||||
@ -6,15 +7,17 @@ namespace GradeBook
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var numbers = new[] {12.7, 10.3, 1.1};
|
List<double> grades = new List<double>() {12.7, 10.3, 6.11, 4.1};
|
||||||
|
grades.Add(56.1);
|
||||||
double result = 0;
|
double result = 0;
|
||||||
|
|
||||||
foreach (var number in numbers)
|
foreach (var number in grades)
|
||||||
{
|
{
|
||||||
result += number;
|
result += number;
|
||||||
}
|
}
|
||||||
|
result /= grades.Count;
|
||||||
|
|
||||||
System.Console.WriteLine(result);
|
System.Console.WriteLine($"The average grade is {result}");
|
||||||
|
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user