import java.awt.* ; import java.applet.* ; public class ForLoop extends Applet { TextField mytext1 ; TextField mytext2 ; TextField mytext3 ; public void init() { mytext1 = new TextField(5) ; add(mytext1) ; mytext1.setText("1") ; mytext2 = new TextField(5) ; add(mytext2) ; mytext2.setText("10") ; mytext3 = new TextField(5) ; add(mytext3) ; mytext3.setText("1") ; } public void paint(Graphics g) { int intInd = 0 ; int intCount = 0 ; String strHigh = mytext2.getText() ; int intHigh = Integer.parseInt(strHigh) ; String strLow = mytext1.getText() ; int intLow = Integer.parseInt(strLow) ; String strStep = mytext3.getText() ; int intStep = Integer.parseInt(strStep) ; g.drawString("Give Starting, Ending, Step Values" , 40 , 40 ) ; g.setColor(Color.blue) ; for ( intInd = intLow ; intInd <= intHigh ; intInd+=intStep ) { String strPrint = String.valueOf(intInd) ; strPrint += " Iteration" ; g.drawString( strPrint , 40 , 65 + intCount * 15 ) ; intCount++; } } public boolean action(Event event, Object arg) { repaint() ; return true ; } }