KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
When doing this: int x = 100; int result = 1; for (int i = 1; i < (x + 1); i++) { result = (result * i); } System.out.println(result); This is clearly because the result is too big for an integer, but I am used to get big negative numbers for the overflow, and not 0. Thanks in advance! When I switch to this: int x = 100; int result = 1; for (int i = 1; i < (x + 1); i++) { result = (result * i); System.out.println(result); } I get this .
Tags (comma-separated)
Save Edits
Cancel