Program to print a table of given number in java.
package vedvarshney ;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
int num,i,tab;
Scanner sc=new Scanner(System.in);
System.out.print("enter the number =");
num=sc.nextInt();
System.out.println("the table of given number is=");
for(i=1; i<=10; i++)
{
tab=i*num;
System.out.println(tab);
}
}
}
■》 Output->
enter the number =5
the table of given number is=>
5
10
15
20
25
30
35
40
45
50
Comments
Post a Comment