Saturday, 7 June 2014

Program to create multiplication table in BlueJ


Multiplication Table
import java.util.*;
class table
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int a,x=1;
        System.out.println("This program will give you table of any no. till 10");
        System.out.println("Enter a number");
        a=sc.nextInt();
        for (int i=a;i<=a*10;i=i+a)
        {
                System.out.println(a+" X "+x+" = "+i);
                x=x+1;
            }
        }
    }

No comments:

Post a Comment