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

When a method in a subclass overrides a method in superclass, it is still possible to call the overridden method using super keyword - Hacker Rank Solution.

You are given a date. You just need to write the method getDay which returns the day on that date - Hacker Rank Solution.