Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue