
-----------------------------------
starlight
Fri Feb 03, 2006 7:39 pm

counter
-----------------------------------
method returns the value of the digit that is position places from the right in the decimal representation of n.

e.g 

Enter Number: 8574

What digit do you want? 2

The digit is 5

This is what i got so far . dont' really understand why it is not working. 


class position1 {
   public static void main(String[] args) {
     int n, position;
     System.out.println("number");
     n=In.getInt();
     System.out.println ("position");
     position=In.getInt();
    digit(n,position);
} 
   public static int digit(int n, int position) {
     if (position==2) {
     for (int i=1; i