Hello,
I need to do this:
Write an application that accepts a number from the user and prints its multiplication table values (multiply it by 1 through 12 and print the results).
Now, here is what I am doing....
If someone wants to get the multiplication table, my program will ask them to enter a numbr i.e. 2
and it will give him/her multiplication 2 until 12 times...
like
2*1 = 2
2*2 = 4
2*3= 6 etcc
(I think I am definitely on a wrong track) Anywhoo, this what I tried...
import java.io.*;
public class c2c2 {
public static void main(String args[]) {
BufferedReader reader;
String number;
int num1;
int num2=2;
reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("\nPlease type in a number: ");
try {
number = reader.readLine();
num1 = Integer.parseInt(number);
System.out.println("Thank You, let me get the multiplication table for the number " + number);
System.out.println(number + " * 2 = " +(number * num2));
System.out.println(number + " * 2 = " +(number * num2 * num2));
System.out.println(number + " * 2 = " +(number * num2 * num2 * num2)); //<--I will have this 12 times, to give 12 lines
}
catch(IOException ioe) {
System.out.println("IO Exception Occurred");
}
}
}
I am still in learning mode, started programming like 2 days ago by myself :P
Anyway, some help will be appreciated.
Edited by: kevingupta.2271990 on Aug 15, 2010 6:14 PM