numeric_limits

Lab C++ Intermediate 20 points

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
Sample output available
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;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD