Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,23 @@
using System;
namespace rms
{
class Program
{
static void Main(string[] args)
{
int[] x = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Console.WriteLine(rootMeanSquare(x));
}
private static double rootMeanSquare(int[] x)
{
double sum = 0;
for (int i = 0; i < x.Length; i++)
{
sum += (x[i]*x[i]);
}
return Math.Sqrt(sum / x.Length);
}
}
}

View file

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace rms
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(rootMeanSquare(Enumerable.Range(1, 10)));
}
private static double rootMeanSquare(IEnumerable<int> x)
{
return Math.Sqrt(x.Average(i => (double)i * i));
}
}
}