How to Print a Table of Any Number in Java Programming Language

Hello Guys🤙


In Our Previous Block, We Have Seen the Basics of Java Programming and Some Simple Programs.

In today's Blog We will see a Program to Print a Table of Any Number in Java Programming Language. 


Program of for Loop to Print a Table of Any Number in Java Programming Language. 

Program - Table Print


import java.io.*;

import java.util.Scanner;

class TablePrint {

 public static void main(String[] args) 

{

 Scanner obj= new Scanner(System.in);

 int no , i , table;

System.out.println("Enter Any Number : ");

no=obj.nextInt();

System.out.println("Multiplication Table of " + no);

System.out.println("-----------------------------");

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

     {

       table=no*i;

       System.out.println(no+" * "+i+" = "+table);

       }

    }

}


Output - Run two Time -


Enter Any Number = 5
Multiplication Table of 5
-----------------------------------
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25 
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
 
Enter Any Number = 10
Multiplication Table of 5
-----------------------------------
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

If You Want to Know more Java Programming Language - then Click this Link ðŸ‘‡

If You Want to Know About CSS Language and It Web Design, then Click This Link 👇

Can You Want to See the Privacy Policy of this Page then Click on this Link ðŸ‘‡


Hope You Have Got Help in Learning Java Language and His Programs from this Blog. ðŸ¤™
Give Your Feedback on Comment Box 📦 ðŸ‘‡

Comments

Post a Comment