My problem is that I have to change the code so that the user can tell the program which factor that should be the highest one. An example: if the user tells the program that the highest factor should be 4, then the result should be: 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16

ThankÃ?Â´s in advance!

import java.util.Scanner;

class Multiplication

{

public static void main(String args[])

{

int n, c;

System.out.println("Enter an integer to print it's multiplication table");

Scanner in = new Scanner(System.in);

n = in.nextInt();

System.out.println("Multiplication table of "+n+" is :-");

for ( c = 1 ; c <= 10 ; c++ ) System.out.println(n+"*"+c+" = "+(n*c));

}

}

View Answers

March 14, 2012 at 6:05 PM

import java.util.Scanner; class Multiplication { public static void main(String args[]) { int n; System.out.print("Enter the highest factor:"); Scanner in = new Scanner(System.in); n = in.nextInt(); int[][] array = new int[11][n+1]; for (int i=1; i<array.length; i++) { for (int j=1; j<array[i].length; j++) { array[i][j] = i*j; System.out.print(" " + array[i][j]); } System.out.println(""); } } }

March 14, 2012 at 6:09 PM

thanks alot!

Related Tutorials/Questions & Answers:

print the multiplication table up to one My problem is that I have...; System.out.println("Enter an integer to print it's multiplication table...(); System.out.println("Multiplication table of "+n+" is :-"); for ( c = 1 ; c <= 10

Design and develop Multiplication table in Net beans Design and develop a program that will print a multiplication table. The program should: Ask... table. import java.util.Scanner; class Multiplication { public static

Advertisements

Multiplication table Net Beans Using Net beans Design and develop a program that will print a mulyiplication table.The program should; Ask the user for ending number than Display that particular multiplication table

Multiplication table Using Net beans Design and develop a program that will print a mulyiplication table.The program should; Ask the user for ending number than Display that particular multiplication table import

How to Create Multiplication Table from 1 to 10? Hi, I want... table 1 to 10. Please suggest online example related to creating multiplication table. Thanks Hi, Did you want to create multiplication table 1

how to insert one table to anothere table i have insert the record one table then i retrve the value of that table i insert one value at a time

Create Multiplication Table in Java In this section, you will learn how to create multiplication table from 1 to 10. For this purpose, we have created 2-dimensional Array 'array[][]' and using the for loop, we have stored the product

update one table from another table hello, i need to update one table fields by using another table fields. I have to tables Products... enter the Quantity field in table 'Products_Purchased'In table 'Products' one item

multiplication multiplication of two number numbers entered by user minimum 100digits using GUI Java Multiplication of two 100 digits number import java.awt.*; import java.math.*; import javax.swing.*; import

multiplication multiplication of two number numbers entered by user minimum 100digits using GUI Java Multiplication of two 100 digits number import java.awt.*; import java.math.*; import javax.swing.*; import

excel parsing and print data in the form of table my reqment is i have to parse the excel and i need to print the data in the table by using swing jtable or else ....can u give the solution please

how to fill up a form automaically from database and print it sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir Have

how to fill up a form automaically from database and print it sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir Have

how to fill up a form automaically from database and print it sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir Have

how to fill up a form automaically from database and print it sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir Have

how to fill up a form automaically from database and print it sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir Have

how to fill up a form automaically from database and print it sir,i...)should automatically fill up in the form and on cliking print button it shoulg give a print out. i need code for this in jsp .plsss help me sir Here

Use of mysqldump for taking backup of one table In this section you will see the example of mysqldump function which takes the backup of only one table... to take the backup of only one table from the database

Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below HI, I have... the table rows up to view more underlying data, then, the table's header (1st row

Copy One Database Table to Another In this section, you will learn to copy one database table to another database table. That means we copy one table to a different table

copying data from one table to another i need to copy data from one table to another table.. i.e the 1st eid of employee table must be copied to the 1st eid in appusers table, 2nd eid of employee to the 2nd eid of appusers

retrieve the records from one table to another table by using cursors ... from one table to another table by using cursors.The following is my procedure and tables.After execution it insert one extra record to another table. empproc

simply create a table 'Multiplication' with required fieldname and datatype... Multiplication: mysql> CREATE TABLE Multiplication... The Query for inserting a records or rows to the table 'Multiplication

a table 'Multiplication' with required fieldname and datatype respectively. ADS_TO_REPLACE_2 Query for creating table name Multiplication:ADS_TO_REPLACE_3 mysql> CREATE TABLE Multiplication

a pop up window appears with two drop down lists and a button. One of the drop... pop up menu with a select button in each row.when I click any one select button...get data in pop up window droplists and on selecting data in the same show

take data from one table and insert same in another I want to know when a new field update in table and the same data has to update in another table

how to count unique and duplicate values from one table in mysql? I have use EMP table.I want to count unique and duplicate records from emp table and how to use in java program

How to compare two tables, and insert values which r not in one table to another table? Hi I need to compare two tables MainTable and OUTTable... insert the values to main_table... here is my sql query insert into Main_Table

Parallel multiplication matrix in java hello dear I need parallel multiply matrix in java algorithm to account speed up and efficiency great wishes

In this section, you will learn One to One mapping of table in Hibernate using Xml

Matrix multiplication program to read the elements of the given two matrices of order n*n and to perform the matrix multiplication

related objects. It's part of java.lang namespace. out: out being one of those... into the stream and, as opposed to print() method, gets you to the new line after the text

print How to print JFrame All Componant? Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml

how to move records from one table to other based on its creation time Hi all,, As part of my requirement ,the records in one table have to move to second table based on the record creation time means the records should

An exercise using (SRS) as a blue print for Abstraction and Modeling in a one page answer. Was this example correct? The software tool to help automate the process of producing a blueprint for problems with a television

Server side validation on dynamically generated fields from more than one table on spring framework. Server side validation on dynamically generated fields from more than one table in spring mvc framework

ModuleNotFoundError: No module named 'multiplication' Hi, My... named 'multiplication' How to remove the ModuleNotFoundError: No module named 'multiplication' error? Thanks Hi, In your python

ModuleNotFoundError: No module named 'multiplication' Hi, My... named 'multiplication' How to remove the ModuleNotFoundError: No module named 'multiplication' error? Thanks Hi, In your python

Multiplication problem I am facing a peculiar problem in java regarding a multiplication. Please see below: 19300 * 0.001 = 19.3 19400 * 0.001 = 19.400000000000002 (why is this ??) 19500 * 0.001 = 19.5 Can anybody help

using dense parallel matrix multiplication. I request you to kindly provide me a code for Parallel Matrix multiplication on distributed systems using Java

can't figure out, how to construct a table,with two fixed columns, one that reads...table? Hi, how could i make a table in javascript, which would look like this: AA CODON Number /1000 Fraction .. (this row

multiplication algorithms in java divide and conquer I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java

multiplication algorithms in java divide and conquer I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java

multiplication algorithms in java divide and conquer I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java

, one which executes up to the number of rows and second one will execute up...Matrix multiplication in java In this section we will learn about multiplication of two matrices. In java this is a simple program to multiply two matrices

java program_big digits multiplication.. i want program about big digits multiplication program using java..plz tel me answer

java string multiplication Is there any simple method of string multiplication in java ..? public class StringMultiplication { public static void main(String[] args) { String number1 = "17"; String number2

Table How i generate table in showMessageDialog. I want that i creat a table and run in showMessageDialogeprint("cprint("code sample");ode sample

Ads