25 lines
582 B
Text
25 lines
582 B
Text
/* Test what happens for Integers that are to big for 32bits
|
|
2147483647 (=0x7FFFFFFF) is the biggest integer in 32bits (IntMAX)
|
|
*/
|
|
class Main {
|
|
void main() {
|
|
int x,y,z;
|
|
x = 2147483647;
|
|
write( x ); writeln();
|
|
/* add 1 to IntMax and output it */
|
|
write( x + 1); writeln();
|
|
|
|
/* read an int bigger than IntMAX */
|
|
x = read();
|
|
write(x); writeln();
|
|
|
|
/* performe some operation that should generate an int overflow */
|
|
x = 21474836400;
|
|
y = 60000;
|
|
write( x + y); writeln();
|
|
z = 20000000;
|
|
write( y * z); writeln();
|
|
write( (y * z) ); writeln();
|
|
|
|
}
|
|
}
|