import java.util.*;
import java.io.*;
public class  Conversion
{
public static void main(String[] args) 
{
try{
  int N,d,c,result;
  String res=new String();
  Stack s=new Stack();
  System.out.println("Please Input N");
  N=System.in.read();
  System.out.println("please Input d");
  d=System.in.read();
  while ((c=System.in.read())=='\n')
  {
   while (N!=0)
   {
    result=N%d;
     s.push(new  Integer(result));//这里老是报错,该如何解决
    N=N/d;
   }
  }
  while (!s.isEmpty())
  {
   res=s.pop().toString();
   System.out.println(res);
  }
}catch(IOException e){
System.out.println(e);}
}
}
没有错误了