import java.awt.*;
import java.applet.*;
public class itoa extends Applet {
Label prompt;
TextField input;
int n = 0, yPos = 70;
public void init() {
prompt = new Label("Please enter non-negative number: ");
input = new TextField(8);
add(prompt);
add(input);
}
public void paint(Graphics g) {
showStatus("The number is: " + n);
do {
g.drawString("Digit = " + (char) (n % 10 + '0'), 40, yPos += 15 );
} while ( (n /= 10) > 0 );
}
public boolean action(Event event, Object o) {
n = Integer.parseInt( input.getText());
input.setText("");
yPos = 70;
repaint();
return true;
}
}