# C#.Net Math Class and Its Methods

C#.Net Math Class and Its Methods: Learn C# Math Class’s Methods with Example, this post contains list of C#.Net Math class’s methods.

Math is a pre-defined class in C#.Net, which has many methods to perform mathematical operations without using operators for that.

This post contains some of the common and most popular Math class’s methods which may help you to perform related operations in C# program.

These are following important methods are used in c#:

1. Math.Pow()
2. Math.Sqrt()
3. Math.Max()
4. Math.Min()
5. Math.Ceiling()
6. Math.Floor()

### 1) Math.Pow()

This method is used to calculate power of given number.

### 2) Math.Sqrt()

This method is used to calculate square root of given number.

### 3) Math.Max()

This method is used to find largest number from two given number.

### 4) Math.Min()

This method is used to find smallest number from two given number.

### 5) Math.Ceiling()

This method is used to ceil given floating point number.

### 6) Math.Floor()

This method is used to floor given floating point number.

Consider the program:

```using System;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double num    = 0;
double power = 0;
double result = 0;

Console.Write("Enter Number : ");

Console.Write("Enter Power : ");

result = Math.Pow(num, power);
Console.WriteLine("Result : " + result);

result = Math.Sqrt(16);
Console.WriteLine("Result : " + result);

result = Math.Max(10.2, 10.5);
Console.WriteLine("Result : " + result);

result = Math.Min(10.2, 10.5);
Console.WriteLine("Result : " + result);

result = Math.Ceiling(10.2);
Console.WriteLine("Result : " + result);

result = Math.Floor(10.2);
Console.WriteLine("Result : " + result);

}
}
}
```

Output

```Enter Number : 2
Enter Power : 3
Result : 8
Result : 4
Result : 10.5
Result : 10.2
Result : 11
Result : 10
```

TOP Interview Coding Problems/Challenges

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates