If the user inputs 1998, can I assign 19 to x and 98 to y?
thanks :)
---------- Post added at 05:04 PM ---------- Previous post was at 04:47 PM ----------
nevermind, I figured out how to do it. For anyone curious to how I did it, check out this code I wrote:
int x = Integer.parseInt(userInput); int y = x % 100; x = x / 100;
the user inputs a number, x. Say the number is 1998.
First, I take the string that the user (inputted?) and convert it to an integer.
next, I take the integer and % it by 10 to get the remainder of 98 and store that in one variable, y, and next I divide the variable x by 10 to get 19.


Sign In
Create Account


Back to top









