Given two integer a and b, find whether their product (a x b) exceed the signed 64 bit integer or not. If it exceed print Yes else print No.
Input : a = 100, b = 200 Output : No Input : a = 10000000000, b = -10000000000 Output : Yes
- If either of the number is 0, then it will never exceed the range.
- Else if the product of the two divided by one equals the other, then also it will be in range.
- In any other case overflow will occur.
Time complexity : O(1)
- How to avoid Structure Padding in C?
- Booth’s Multiplication Algorithm
- C function argument and return values
- Sum of first n even numbers
- searching in fork()
- Program to print hollow rectangle or square star patterns
- C Program to display hostname and IP address
- Multiply large integers under large modulo
- Generating Test Cases (generate() and generate_n() in C++)
- Fast I/O for Competitive Programming
- How to split a string in C/C++, Python and Java?
- Map in C++ Standard Template Library (STL)
- Euler's Totient function for all numbers smaller than or equal to n
- Commonly Asked C++ Interview Questions | Set 1
- Can we call an undeclared function in C++?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Saif Haider