Table Program in Java

Advertisements

Prev Tutorial Next Tutorial

Java program to print multiplication table

The concept of generate Table of any number is :
num * 1
num * 2
num * 3
num * 4
num * 5
num * 6
num * 7
num * 8
num * 9
num * 10

Example

import java.util.Scanner;
class Table 
{
public static void main(String[] args) 
{
int i,no,table=1;
Scanner s=new Scanner(System.in);
System.out.println("Enter any number: ");
no=s.nextInt();
for(i=1; i<=10; i++)
{
table=no*i;
System.out.println(table);
}
}
}

Output

Enter any number :
5
5
10
15
20
25
30
35
40
45
50

Syntax to compile and run java program

Syntax

for compile -> c:/>javac Table.java
for run -> c:/>java Table

Explanation of Code

  • Scanner s=new Scanner(System.in): are used for receive input from keyboard.
  • nextInt(): method are used for get integer type value from keyboard.
  • System.out.println("....."): are used for display message on screen or console.

Prev Tutorial Next Tutorial

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements