C#: Calculate the full product of two 32-bit numbers
C# Sharp Math: Exercise-9 with Solution
Write a C# Sharp program to calculate the full product of two 32-bit numbers.
Sample Solution:
C# Sharp Code:
using System;
using System.Text;
namespace exercises {
class Program {
public static void Main() {
int int1 = Int32.MaxValue;
int int2 = Int32.MaxValue;
long longResult;
longResult = Math.BigMul(int1, int2);
Console.WriteLine("Calculate the product of two Int32 values:");
Console.WriteLine("{0} * {1} = {2}", int1, int2, longResult);
}
}
}
Sample Output:
Calculate the product of two Int32 values: 2147483647 * 2147483647 = 4611686014132420609
Flowchart:
C# Sharp Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a C# Sharp program to calculate the quotient of two 32-bit signed integers and also returns the remainder in an output parameter.
Next: Write a C# Sharp program to reverse the digits of a given signed 32-bit integer.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/csharp-exercises/math/csharp-math-exercise-9.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics