using System; public class Multiplication { public int Multiply(int a, int b) => Convert.ToInt32(Math.BigMul(a, b)); }
- using System;
- public class Multiplication
- {
// Multiply two integers// Throws error if the product is outside of the int range.// This would otherwise silently error and return the wrong product.public int Multiply(int a, int b) {long res = Math.BigMul(a, b);// Convert.ToInt32 throws OverFlowException if conversion is out of the bounds of the integer.return Convert.ToInt32(res);}- public int Multiply(int a, int b) => Convert.ToInt32(Math.BigMul(a, b));
- }