How to use the decimal Negate() method to makes positive decimals negative, and negative decimals positive in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(decimal.Negate(3.14M));
            Console.WriteLine(decimal.Negate(-3.14M));
        }
    }
}

/*
run:
   
-3.14
3.14

*/

 



answered Jan 17, 2017 by avibootz
...