Ad
Code
Diff
  • class Kata{
      public static void Main(){
        System.Console.WriteLine("Hello, C#!");
      }
    }
    • class Kata{
    • public static void Main(){
    • string language = "C#";
    • System.Console.WriteLine("Hello, {0}!",language);
    • System.Console.WriteLine("Hello, C#!");
    • }
    • }
Fundamentals
Numbers
Data Types
Integers
Code
Diff
  • public static class Kata
    {
        public static bool IsOdd(int input)
        {
            if (input % 2 == 0)
             return false;
            else
             return true;
        }
    }
    • public static class Kata
    • {
    • public static bool IsOdd(int input)
    • {
    • if (input % 2 == 0)
    • {
    • return false;
    • }
    • else
    • {
    • return true;
    • }
    • }
    • }
Code
Diff
  • def converter(number):
        if number == 0:
            return "zero"
        elif number == 1:
            return "one"
        elif number == 2:
            return "two"
        elif number == 3:
            return "three"
        elif number == 4:
            return "four"
        elif number == 5:
            return "five"
        elif number == 6:
            return "six"
        elif number == 7:
            return "seven"
        elif number == 8:
            return "eight"
        elif number == 9:
            return "nine"
        return number
    • def converter(number):
    • if number == 0:
    • return "zero"
    • elif number == 1:
    • return "one"
    • elif number == 2:
    • return "two"
    • elif number == 3:
    • return "three"
    • elif number == 4:
    • return "four"
    • elif number == 5:
    • return "five"
    • elif number == 6:
    • return "six"
    • elif number == 7:
    • return "seven"
    • elif number == 8:
    • return "eight"
    • elif number == 9:
    • return "nine"
    • return number
Code
Diff
  • public class FizzBuzz
    {
        public string GetOutput(int number)
        {  
            if (number % 3 == 0 && number % 5 == 0)
               return "FizzBuzz";
            if (number % 3 == 0)  
                return "Fizz";
            if (number % 5 == 0)  
                return "Buzz";  
            return number.ToString();
        }
    }
    • public class FizzBuzz
    • {
    • public string GetOutput(int number)
    • {
    • if (number % 3 == 0 && number % 5 == 0)
    • {
    • return "FizzBuzz";
    • }
    • if (number % 3 == 0)
    • {
    • return "Fizz";
    • }
    • return "Fizz";
    • if (number % 5 == 0)
    • {
    • return "Buzz";
    • }
    • return number.ToString();
    • }
    • }