I've tried to build a factorial generator out of words, but every time I enter some big numbers, it makes my numbers negative.
I figured I should use a long with an identifier (L). I've applied it to the initialization of the long, but that didn't fix it. I guess the problem is somewhere around here:
for (int j = 1 ; j <= wordLength; j++) {
temp *= j;
}
how do I assign the L to temp so it reserves enough space for the number to fit in?
The
lisn't applied to variable-names. You can of course do that to include the type of a variable in it's name, but that's rather a question of style than anything else, like this:lis only used for constants in the code, likeVariables don't magically change their type during execution of code. You'll have to declare the variable as long.