public class Return {
public static void main(String[] args) {
int answer = digit(9635, 1);
print("The answer is " + answer);
}
static void print(String karen) {
System.out.println (karen);
}
static int digit(int a, int b) {
int digit = a;
return digit;
}
}
Create a program that uses a function called digit which returns the value of the nth digit from the right of an integer argument. The value of n should be a second argument.
For Example: digit(9635, 1)
returns 5
and digit(9635, 3)
returns 6
.