Monday, 4 July 2016

Write a Java program to create an Applet to generate table of 10

import java.applet.Applet;
import java.awt.*;
public class tableof10 extends Applet {
      int count,i;
 
   public void init(){
      this.count=10;
    }

    public void paint(Graphics g) {
        for(i=1;i<=10;i++)
        {
            g.drawString(i+ "* 10 =" +i*10,150,count);
            count=count+20;
        }
   
    }

}

Applet code:

<html>
     <head>
          <title>table of 10</title>
     </head>
     <body>
          <applet code="tableof10.class" height="500" width="500"></applet>
     </body>
</html>

OUTPUT:

3 comments:

  1. Hello Pranab....1*10=10 is not getting printed how to print this..please help.

    regards
    Dipankar

    ReplyDelete
    Replies
    1. i updated the codes.
      plz try with recent codes...

      Delete
  2. Write a program in Java to create an applet which generates the table of a given
    number between 1-10. If number entered is not in this range ask the user to input the
    number again and if input number is zero exit from the program.

    ReplyDelete

Popular Posts