Java: Write a program to print Table

Problem :-

Q. Write a program which you want print any number of table.

Solution :-

import java.util.*;

class Main

{

    public static void main(String args[])

    {

        Scanner sc=new Scanner(System.in);

        System.out.print("which table you want to print=");

        int n=sc.nextInt();

        for(int i=1;i<=10;i++)

        {

           int result=n*i;

          System.out.println(n+"x"+i+"="+result);

        }

    }

Output :-


Post a Comment

Previous Post Next Post