Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Print Table of a Given Number

Article:
Viewed:  1142 
Posted On:  24/07/2013 03:47:10 
Hi all,With the help of this article i am going to tell you that how we can find out the multiplication table of the number given by the user........ 

 

Below is my code:


import java.util.Scanner;
class table
{
public static void main(String s[])
{
int a,b,c;
System.out.println("enter  no. ");
Scanner scan=new Scanner(System.in);
a=scan.nextInt();
System.out.println("you entered ="+a);
for(b=1;b<=10;b++)
{
c=a*b;
System.out.print(""+a);
System.out.print("*"+b);
System.out.print("="+c);
System.out.println("");
}
}
}

  Step 1:
  After writing this in notepad save the file with the name followed by (.java) for eg. I saved it with table.java

  Step 2 : 
Open command prompt 

  Step 3 : 
Write javac table.java - Press Enter for compilation

 Step 4 : 
Write java table for execution

Output:

Table.png

Image 1.

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us