C# System.Math Class - with easy programming examples

In this tutorial, you will learn:
1. What is Math class in C# ?
2. C# Math Functions and Fields

While learning C#, it is necessary to know some useful classes to improve functionality without writing own code for several task. Instead of writing your own code for various kind of mathematical operations in c sharp, you just need to know some predefined static methods and constant fields in System.Math class. By studying this lesson, you will be able to write sophisticated code in c# for various types of math operations by using the robust predefined methods and fields.

What is Math class in C#?

The Math class comes under System namespace, and it is used for trigonometric, logarithmic, and other common mathematical functions. This class makes mathematical operations easy for programmer and they don’t need to write their own code for various kind of mathematical calculations. In the Math class, there are several useful and handy functions are built-in, which can be used easily.

Here, I am only collecting the most useful methods in Math class. For the complete list of functions in Math class, you can visit the docs.microsoft.com.

C# Math class useful functions:
Functions:
  1. Abs
  2. Acos
  3. Asin
  4. Atan
  5. Cbrt
  6. Ceiling
  7. Floor
  8. Max
  9. Min
  10. Pow
  11. Round
  12. Sqrt
  13. Truncate

Fields
  1. E
  2. Pie
  3. Tau

Summary

This tutorial is all about System.Math function in C# 10. You will learn various Math() class methods and members with easy programming example in C#.

More Articles

 

Share your thought