numeric_limits
Completed
Print the maximum int, the maximum long long, and what INT_MAX + 1 becomes when computed as a long long.
Input
None.
Output
Three lines.
Example
Output
2147483647 9223372036854775807 2147483648
Editor
C++
Hints
#include <limits> for numeric_limits<T>::max().
Solution explanation
Use long long (64-bit) when values can exceed about 2.1 billion.
Show solution
#include <iostream>
#include <limits>
using namespace std;
int main() {
int maxInt = numeric_limits<int>::max();
long long maxLL = numeric_limits<long long>::max();
cout << maxInt << "\n" << maxLL << "\n" << static_cast<long long>(maxInt) + 1 << "\n";
return 0;
}