Java Program for print the TABLE of a number.


 JAVA CODE - TABLE OF A NUMBER:


import java.util.Scanner;
class TableOfNumber
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter a Number");
        int num=sc.nextInt();
        if(num>0)
        {
            for(int i=1;i<=10;i++)
            {
                System.out.println(num+" * "+i+" = "+num*i);
            }
        }
        else
        {
            System.out.println("Wrong Number");
        }
    }
}

Popular posts from this blog

In this problem, you will practice your knowledge on interfaces - Hacker Rank Solution.