Fundamentals
Numbers
Data Types
Integers
Make a function that determines if a number is odd.
public static class Kata
{
public static bool IsOdd(int input)
{
return ((input % 10 == 1) || (input % 10 == 3) || (input % 10 == 5) || (input % 10 == 7) || (input % 10 == 9));
}
}
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));
}
}
}