Project Euler 6
using System; namespace PE { public class PE006 { public static void Calc() { int sumsq = 0; for (int i = 1; i <= 100; i++) { sumsq += i * i; } int sqsum = (int)Math.Pow(100 * 101 / 2, 2); Console.WriteLine(sqsum - sumsq); } } }
using System; namespace PE { public class PE006 { public static void Calc() { int sumsq = 0; for (int i = 1; i <= 100; i++) { sumsq += i * i; } int sqsum = (int)Math.Pow(100 * 101 / 2, 2); Console.WriteLine(sqsum - sumsq); } } }