Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
Fundamentals
Code
Diff
  • using System;
    
    public class Kata
        {
            public  static int Opposite(int number)
            {
                // Happy Coding
                return number/-1;
            }
        }
  • 11
    using System;
    
    22
    33
    public class Kata
    
    44
        {
    
    55
            public  static int Opposite(int number)
    
    66
            {
    
    77
                // Happy Coding
    
    8
                return number*-1;
    
    8+
                return number/-1;
    
    99
            }
    
    1010
        }
    
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;
        }
    }