Showing posts with label table of any number. Show all posts
Showing posts with label table of any number. Show all posts

Thursday, 13 June 2013

table of any number in java

import java.io.*;
class simple_table_of_any_number
{
    public static void main(String args[])
    {
        int i=1,n,table;
        try
        {
            DataInputStream cin=new DataInputStream(System.in);
            System.out.println("Enter the number which you want print a table");
            n=Integer.parseInt(cin.readLine());
            System.out.println();

            while(i<=10)
            {
                table=i*n;
                System.out.println(table);
                i++;
            }
        }
        catch(Exception e)
        {
            System.out.println("wrong data");
        }
    }
}