Java program to print multiplication table of any number

import java.util.Scanner;
public class MultiplicationTablesInJava
{
   public static void main(String[] args)
   {
      System.out.println("Please enter an integer to print tables : ");
      Scanner sc = new Scanner(System.in);
      int number = sc.nextInt();
      System.out.println("Multiplication table of " + number + " is : ");
      for(int a = 1; a <= 10; a++)
      {
         System.out.println(number + " * " + a + " = " + number * a);
      }
      sc.close();
   }
}

4.5
2
Lucas Dean 110 points

                                    public static String multiTable(int num) {
        StringBuilder sb = new StringBuilder();

        for (int i = 1; i &lt;= 10; i++) {
            int result = i * num;
            sb.append(i + &quot; * &quot; + num + &quot; = &quot; + result + &quot;\n&quot;);
        }
        return sb.toString().trim();
    }

4.5 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
long method multiplication table in java Write a Java program that takes a number as input and prints its multiplication table upto 10. Write a java program to print the multiplication table of any given number program to generate multiplication table in java java program to multiplication table from user Write a program in Java to display the multiplication table of a given integer up to 10. multiplication tables java how to multiplication table java printing a multiplication table in java printing multiplication table in java program on multiplication of table 2 in java display multiplication table in java multiplication table using java java Write a program that prints out the multiplication table from 1 to 9 like: how to print a 10x10 multiplication table in java multiplication table in java using function how to make table of multiplication table java java multiplication table user decides the number multiplication table java program multiplication table application java java program to print multiplication table of multiple numbers java program to print multiplication table from 1 to 5 java program to print multiplication table from 1 to 10 how to print multiplication table in java multiplication table of 10 java how to make multiplication table in java write a java program to display multiplication table how to print the whole multiplication table in java java Write a program that prints a multiplication table for numbers up to 12 how to print a table in java java program array to print multiplication table multiplication table 3x3 java java multiplication table calculate multiplication table java times table java Write a Java program that takes a number as input and prints its multiplication table upto 10 in java multiplication table using input stream in java prinitng tables in java java program to display multiplication table print multiplication table for any range in java multiplication table in java using for loop multiplication table in java using nested for loop Java program to print multiplication table of any number write a java program to help children multiplication.it should ask the user which number they are learning to multiply and then produce a set of 12 multiples print table in java java code table how to print 2 time 1 to 12 in java print 2 time 2 to 12 in java table of 0,1 in java Create a program using a for loop which will print out the 4&rsquo;s times table through 10. print table of 2 in java Write a Java program that will print out the times tables for all numbers between 1 and 12 using nested for loops. multiplication table in java multiplication table java multiplication table n*n java java multiplication table for loop Multiplication table for number Java
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source