Math class can be use for maths related calculation.
some of useful math class methods are illustrated with example.
- Math.BigMul() : use for getting multiplication of two number.
- Math.Ceiling() : use for getting number that is greater than or equal to the specified double-precision floating-point number.
- Math.Floor() : use for getting integer that is less than or equal to the specified double-precision floating-point number.
- Math.Sin() : Returns the sine of the specified angle.
- Math.Cos() : Returns the cosine of the specified angle.
- Math.Tan() : Returns the tangent of the specified angle.
- Math.Sqrt() : Returns the square root of a specified number.
- Math.Max() : Returns the larger of two number.
- Math.Min() : Returns the smaller of two number.
using System;
namespace CsharpProgram
{
class Program
{
static void Main(string[] args)
{
double Multiplication, CeilingValue, FloorValue;
Multiplication = Math.BigMul(7823, 2345);
CeilingValue = Math.Ceiling(76.43);
FloorValue = Math.Floor(76.43);
Console.WriteLine("7823 * 2345 = " + Multiplication);
Console.WriteLine("Ceiling value of 76.43 is " + CeilingValue);
Console.WriteLine("Floor value of 76.43 is " + FloorValue);
double sin_Result, cos_Result, tan_Result;
sin_Result = Math.Sin(30);
cos_Result = Math.Cos(30);
tan_Result = Math.Tan(30);
Console.WriteLine("Sin of angle 30 is " + sin_Result);
Console.WriteLine("Cos of angle 30 is " + cos_Result);
Console.WriteLine("Tan of angle 30 is " + tan_Result);
double SquareRoot;
SquareRoot = Math.Sqrt(144);
Console.WriteLine("Square Root of 144 is " + SquareRoot);
int MaxValue, MinValue;
MaxValue = Math.Max(34, 76);
MinValue = Math.Min(34, 76);
Console.WriteLine("Maximum of 34 and 76 is " + MaxValue);
Console.WriteLine("Minimum of 34 and 76 is " + MinValue);
Console.ReadKey();
}
}
}
some of useful math class methods are illustrated with example.
- Math.BigMul() : use for getting multiplication of two number.
- Math.Ceiling() : use for getting number that is greater than or equal to the specified double-precision floating-point number.
- Math.Floor() : use for getting integer that is less than or equal to the specified double-precision floating-point number.
- Math.Sin() : Returns the sine of the specified angle.
- Math.Cos() : Returns the cosine of the specified angle.
- Math.Tan() : Returns the tangent of the specified angle.
- Math.Sqrt() : Returns the square root of a specified number.
- Math.Max() : Returns the larger of two number.
- Math.Min() : Returns the smaller of two number.
using System;
namespace CsharpProgram
{
class Program
{
static void Main(string[] args)
{
double Multiplication, CeilingValue, FloorValue;
Multiplication = Math.BigMul(7823, 2345);
CeilingValue = Math.Ceiling(76.43);
FloorValue = Math.Floor(76.43);
Console.WriteLine("7823 * 2345 = " + Multiplication);
Console.WriteLine("Ceiling value of 76.43 is " + CeilingValue);
Console.WriteLine("Floor value of 76.43 is " + FloorValue);
double sin_Result, cos_Result, tan_Result;
sin_Result = Math.Sin(30);
cos_Result = Math.Cos(30);
tan_Result = Math.Tan(30);
Console.WriteLine("Sin of angle 30 is " + sin_Result);
Console.WriteLine("Cos of angle 30 is " + cos_Result);
Console.WriteLine("Tan of angle 30 is " + tan_Result);
double SquareRoot;
SquareRoot = Math.Sqrt(144);
Console.WriteLine("Square Root of 144 is " + SquareRoot);
int MaxValue, MinValue;
MaxValue = Math.Max(34, 76);
MinValue = Math.Min(34, 76);
Console.WriteLine("Maximum of 34 and 76 is " + MaxValue);
Console.WriteLine("Minimum of 34 and 76 is " + MinValue);
Console.ReadKey();
}
}
}
No comments:
Post a Comment