Help me to display Multiplication table in cmd using Import java.io* . This is my Project. Please help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me to display Multiplication table in cmd using Import java.io* . This is my Project. Please help me

Then when i run the program a little box appear with a question: Enter number of rows and number of columns. My teacher said it is a For loop inside a For loop

3rd Oct 2016, 6:08 AM
Earl Gerald
Earl Gerald - avatar
2 Answers
+ 1
If your store the input in variables named rows and cols, do something like that: for (int i = 1; i <= rows; i++) { for (int j = 1; j <= cols; j++) { System.out.println(i + "*" + j + " = " + i*j); } System.out.println(); }
3rd Oct 2016, 9:40 AM
Zen
Zen - avatar
0
class T {static int a; static void table(int b) { a=b; int c; for(int i=1;i<=10;i++) { c=a*i;; System.out.println(c); } } public static void main(String[] args) { T.table(12); T.table(2); } } //java.io.*; is by default provided by JVM ,so u hv no need to write it but if u want u may
3rd Oct 2016, 5:11 PM
Ankur Sharma
Ankur Sharma - avatar