How to print table of N in JAVA?


How to print table of N in JAVA?


import java.util.*;
class loop
{
        public static void main(String[] args)
        {
                int i;
                int a;
                Scanner in=new Scanner(System.in);
                System.out.print("Enter a=");
                a=in.nextInt();
                for(i=1;i<=10;i++)
                {
                        System.out.println(a +"*" +i +"=" +(a*i));
                }
        }
}

Output:

Enter a=10

10*1=10
10*2=20
10*3=30
10*4=40
10*5=50
10*6=60
10*7=70
10*8=80
10*9=90
10*10=100

How to print table of N in JAVA? How to print table of N in JAVA? Reviewed by Unknown on January 28, 2019 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.