Math.BigMul() Method in C#


The Math.BigMul() method in C# is used to calculate the full product of two 32-bit numbers. The method returns an Int64 integer with the production of both the numbers.

Syntax

Following is the syntax −

public static long BigMul (int val1, int val2);

Here, val1 is the 1st number to multiply, whereas val2 is the 2nd number.

Example

Let us now see an example to implement Math.BigMul() method −

using System;
public class Demo {
   public static void Main(){
      int val1 = Int32.MaxValue;
      int val2 = Int32.MaxValue;
      Console.WriteLine("Product of two numbers = " + Math.BigMul(val1, val2));
   }
}

Output

This will produce the following output −

Product of two numbers = 4611686014132420609

Example

Let us see another example to implement Math.BigMul() method −

using System;
public class Demo {
   public static void Main(){
      Int32 val1 = 139897778;
      Int32 val2 = 217878786;
      Console.WriteLine("Product of two numbers = " + Math.BigMul(val1, val2));
   }
}

Output

This will produce the following output −

Product of two numbers = 30480758034737508
raja
Published on 07-Nov-2019 05:44:11
Advertisements