Fundamentals
Numbers
Data Types
Integers
public static class Kata { public static bool IsOdd(int input, int div) { if (input % div == 0) return true; return false; } }
- public static class Kata
- {
public static bool IsOdd(int input)- public static bool IsOdd(int input, int div)
- {
if (input % 2 == 0){return false;}else{return true;}- if (input % div == 0)
- return true;
- return false;
- }
- }
namespace Solution { using NUnit.Framework; using System; // TODO: Replace examples and use TDD by writing your own tests [TestFixture] public class SolutionTest { [Test] public void MyTest() { Assert.AreEqual(true, Kata.IsOdd(1,1)); Assert.AreEqual(false, Kata.IsOdd(2,3)); Assert.AreEqual(true, Kata.IsOdd(12,3)); Assert.AreEqual(false, Kata.IsOdd(18284,13)); } } }
- namespace Solution {
- using NUnit.Framework;
- using System;
- // TODO: Replace examples and use TDD by writing your own tests
- [TestFixture]
- public class SolutionTest
- {
- [Test]
- public void MyTest()
- {
Assert.AreEqual(true, Kata.IsOdd(1));Assert.AreEqual(false, Kata.IsOdd(2));Assert.AreEqual(true, Kata.IsOdd(13));Assert.AreEqual(false, Kata.IsOdd(18284));- Assert.AreEqual(true, Kata.IsOdd(1,1));
- Assert.AreEqual(false, Kata.IsOdd(2,3));
- Assert.AreEqual(true, Kata.IsOdd(12,3));
- Assert.AreEqual(false, Kata.IsOdd(18284,13));
- }
- }
- }