Assume that an int variable x that has already been declared, and initialized to a non-negative value.

LANGUAGE: JAVA

CHALLENGE:
Assume that an int variable x that has already been declared, and initialized to a non-negative value.

Write an expression whose value is the last (rightmost) digit of x.

SOLUTION:

LANGUAGE: JAVA

CHALLENGE:
Assume that an int variable x that has already been declared, and initialized to a non-negative value.

Write an expression whose value is the last (rightmost) digit of x.

SOLUTION:

x % 10