-
Fundamentals
Code using System; public class Kata { public static int Opposite(int number) { return -number; } }
Test Cases using NUnit.Framework; [TestFixture] public class MyTest { [Test] public void Test_1() { Assert.AreEqual(-1, Kata.Opposite(1)); } }
Output:
-
Code - using System;
- public class Kata
- {
- public static int Opposite(int number)
- {
// Happy Codingreturn number*-1;- return -number;
- }
- }
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}