|
|
|
Print Table of a Given Number
|
Article:
|
Viewed:
2093
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:

Image 1.
|
|
|
|
|
|