// GET: FindOddEven public ActionResult Index() { var v = new EvenOdd(); v.msg = ""; return(View(v)); }
public void tes_even_odd() { Assert.True(EvenOdd.isOdd(5)); Assert.False(EvenOdd.isOdd(6)); Assert.True(EvenOdd.isEven(6)); Assert.False(EvenOdd.isEven(5)); }
public void MyTest() { Assert.AreEqual("Even", EvenOdd.EvenOrOdd(2)); Assert.AreEqual("Odd", EvenOdd.EvenOrOdd(1)); Assert.AreEqual("Even", EvenOdd.EvenOrOdd(0)); Assert.AreEqual("Odd", EvenOdd.EvenOrOdd(7)); Assert.AreEqual("Odd", EvenOdd.EvenOrOdd(-1)); }
public void TestZero() { var number = 0; bool?expected = null; var actual = EvenOdd.Check(number); Assert.Equal(expected, actual); }
public static int[] GetFactor(EvenOdd evenOdd) { if (evenOdd == EvenOdd.None) { return(EmptyNumbers); } return(InFieldNumbers.Where(num => num.GetEvenOdd() == evenOdd).ToArray()); }
static void Main() { while (1 < 2) { Console.Write("Enter an integer number: "); // Read an integer from the console int num = int.Parse(Console.ReadLine()); // Get the value "ODD" or "EVEN" from enumeration EvenOdd evenOdd = (EvenOdd)(Math.Abs(num % 2)); Console.WriteLine("The number {0} is {1}.", num, evenOdd); } }
public ActionResult Index(String a) { int num = Convert.ToInt16(a); var v = new EvenOdd(); if ((num % 2) == 0) { v.msg = "Number is Even"; } else { v.msg = "Number is Odd"; } return(View(v)); }
public static Crossings FindCrossings(ArrayList curves, double xlo, double ylo, double xhi, double yhi) { Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi); IEnumerator enumerator = curves.GetEnumerator(); while (enumerator.MoveNext()) { Curve c = (Curve)enumerator.Current; if (c.AccumulateCrossings(cross)) { return null; } } return cross; }
public static Crossings FindCrossings(ArrayList curves, double xlo, double ylo, double xhi, double yhi) { Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi); IEnumerator enumerator = curves.GetEnumerator(); while (enumerator.MoveNext()) { Curve c = (Curve)enumerator.Current; if (c.AccumulateCrossings(cross)) { return(null); } } return(cross); }
static void Main(string[] args) { int[] allNumbers = { 3, 6, 2, 5, 24, 63, 26, 32, 62, 7, 0, 6, 2 }; EvenOdd e = new EvenOdd(); e.GetEven(allNumbers); e.GetOdd(allNumbers); ProcessData pr = new ProcessData(); pr.GetWorkersGroupByCompany(); pr.GetWorkersolderFiftyGroupByCompany(); pr.GetWorkersWithMaxSalaryGroupByCompany(); Fibonacci fib = new Fibonacci(); fib.Count(6); Factorial fact = new Factorial(); fact.Count(7); Console.ReadKey(); }
public void Test5() { Assert.True(EvenOdd.isOdd(5)); Assert.True(EvenOdd.isEven(6)); }
public static Crossings FindCrossings(PathIterator pi, double xlo, double ylo, double xhi, double yhi) { Crossings cross; if (pi.GetWindingRule() == PathIterator.WIND_EVEN_ODD) { cross = new EvenOdd(xlo, ylo, xhi, yhi); } else { cross = new NonZero(xlo, ylo, xhi, yhi); } // coords array is big enough for holding: // coordinates returned from currentSegment (6) // OR // two subdivided quadratic curves (2+4+4=10) // AND // 0-1 horizontal splitting parameters // OR // 2 parametric equation derivative coefficients // OR // three subdivided cubic curves (2+6+6+6=20) // AND // 0-2 horizontal splitting parameters // OR // 3 parametric equation derivative coefficients var coords = new int[23]; double movx = 0; double movy = 0; double curx = 0; double cury = 0; while (!pi.IsDone()) { int type = pi.CurrentSegment(coords); double newx; double newy; switch (type) { case PathIterator.SEG_MOVETO: if (movy != cury && cross.AccumulateLine(curx, cury, movx, movy)) { return(null); } movx = curx = coords[0]; movy = cury = coords[1]; break; case PathIterator.SEG_LINETO: newx = coords[0]; newy = coords[1]; if (cross.AccumulateLine(curx, cury, newx, newy)) { return(null); } curx = newx; cury = newy; break; case PathIterator.SEG_QUADTO: { newx = coords[2]; newy = coords[3]; var dblCoords = new double[coords.Length]; for (int i = 0; i < coords.Length; i++) { dblCoords[i] = coords[i]; } if (cross.AccumulateQuad(curx, cury, dblCoords)) { return(null); } curx = newx; cury = newy; } break; case PathIterator.SEG_CUBICTO: { newx = coords[4]; newy = coords[5]; var dblCoords = new double[coords.Length]; for (int i = 0; i < coords.Length; i++) { dblCoords[i] = coords[i]; } if (cross.AccumulateCubic(curx, cury, dblCoords)) { return(null); } curx = newx; cury = newy; break; } case PathIterator.SEG_CLOSE: if (movy != cury && cross.AccumulateLine(curx, cury, movx, movy)) { return(null); } curx = movx; cury = movy; break; } pi.Next(); } if (movy != cury) { if (cross.AccumulateLine(curx, cury, movx, movy)) { return(null); } } return(cross); }
public void PrimeTest(int input, bool expected) { bool result = EvenOdd.isPrime(input); Assert.Equal(expected, result); }
public void EvenOddTest(int input, string expected) { string result = EvenOdd.GetWord(input); Assert.Equal(expected, result); }
public static Crossings FindCrossings(PathIterator pi, double xlo, double ylo, double xhi, double yhi) { Crossings cross; if (pi.GetWindingRule() == PathIterator.WIND_EVEN_ODD) { cross = new EvenOdd(xlo, ylo, xhi, yhi); } else { cross = new NonZero(xlo, ylo, xhi, yhi); } // coords array is big enough for holding: // coordinates returned from currentSegment (6) // OR // two subdivided quadratic curves (2+4+4=10) // AND // 0-1 horizontal splitting parameters // OR // 2 parametric equation derivative coefficients // OR // three subdivided cubic curves (2+6+6+6=20) // AND // 0-2 horizontal splitting parameters // OR // 3 parametric equation derivative coefficients var coords = new int[23]; double movx = 0; double movy = 0; double curx = 0; double cury = 0; while (!pi.IsDone()) { int type = pi.CurrentSegment(coords); double newx; double newy; switch (type) { case PathIterator.SEG_MOVETO: if (movy != cury && cross.AccumulateLine(curx, cury, movx, movy)) { return null; } movx = curx = coords[0]; movy = cury = coords[1]; break; case PathIterator.SEG_LINETO: newx = coords[0]; newy = coords[1]; if (cross.AccumulateLine(curx, cury, newx, newy)) { return null; } curx = newx; cury = newy; break; case PathIterator.SEG_QUADTO: { newx = coords[2]; newy = coords[3]; var dblCoords = new double[coords.Length]; for (int i = 0; i < coords.Length; i++) { dblCoords[i] = coords[i]; } if (cross.AccumulateQuad(curx, cury, dblCoords)) { return null; } curx = newx; cury = newy; } break; case PathIterator.SEG_CUBICTO: { newx = coords[4]; newy = coords[5]; var dblCoords = new double[coords.Length]; for (int i = 0; i < coords.Length; i++) { dblCoords[i] = coords[i]; } if (cross.AccumulateCubic(curx, cury, dblCoords)) { return null; } curx = newx; cury = newy; break; } case PathIterator.SEG_CLOSE: if (movy != cury && cross.AccumulateLine(curx, cury, movx, movy)) { return null; } curx = movx; cury = movy; break; } pi.Next(); } if (movy != cury) { if (cross.AccumulateLine(curx, cury, movx, movy)) { return null; } } return cross; }
public void EvenOdd_Test() { Assert.True(EvenOdd.IsEven(8)); Assert.False(EvenOdd.IsOdd(4)); }
public void Test_EvenOdd(int input, string expectedResult) { Assert.AreEqual(expectedResult, EvenOdd.EvenOrOdd(input)); }
public void TestEven(int number) { var actual = EvenOdd.Check(number); Assert.True(actual); }