Ad
Fundamentals
Code
Diff
  • using System;
    
    public class Kata
        {
            public  static int Opposite(int number)
            {
                // Happy Coding
                return number/-1;
            }
        }
    • using System;
    • public class Kata
    • {
    • public static int Opposite(int number)
    • {
    • // Happy Coding
    • return number*-1;
    • return number/-1;
    • }
    • }
Fundamentals

Very simple, given a number, find its opposite.

Examples:

1: -1
14: -14
-34: 34

using System;

public class Kata
    {
        public  static int Opposite(int number)
        {
            // Happy Coding
            return number*-1;
        }
    }