Sunday, September 22, 2013

Filled Under: , , , , ,

Program to print number table from 2 to 10

Share

Number Table printing requires a little knowledge of for loop for repeating the chain..

This program print tables for numbers from 2 to 10.

you can also change the range at first outer loop to increase of decrease the range..

Code Box
--------------------
/* A simple program to print Number Table from 2 to 10  */

class table
{
public static void main(String a[])
{
int num,i,j;

System.out.println("--------------------------------------------------------\n");

for(i=2;i<=10;i++)
{
        System.out.print("Table of "+i+" =>"); 
        for(j=1;j<=10;j++)
        {
         num=i*j;
        System.out.print(" | "+num);
        }
System.out.println("\n-------------------------------------------------------\n");

}
}
}


0 comments:

Post a Comment