
Implement a function that returns 1 when a long value can be stored in an int without changing, and 0 when that conversion would lose information.
fits_in_int(42)Expected result
1For your own tracking. Tests grade your code.
fits_in_int(2147483647)Expected result
1fits_in_int(2147483648)Expected result
0fits_in_int(-2147483648)Expected result
1fits_in_int(4294967338)Expected result
0Expected files
fits_in_int.cAllowed functions
None. Write every helper yourself.
Allowed headers

v0.40: Create exercises. Challenge the community.
Meet Studio →Implement a function that returns 1 when a long value can be stored in an int without changing, and 0 when that conversion would lose information.
fits_in_int(42)Expected result
1For your own tracking. Tests grade your code.
fits_in_int(2147483647)Expected result
1fits_in_int(2147483648)Expected result
0fits_in_int(-2147483648)Expected result
1fits_in_int(4294967338)Expected result
0Expected files
fits_in_int.cAllowed functions
None. Write every helper yourself.
Allowed headers

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.