View Single Post
  #1 (permalink)  
Old 07-09-2007, 09:09 PM
Albert Albert is offline
Senior Member
 
Join Date: Jun 2007
Posts: 114
Albert is on a distinguished road
Help with multiplication table
Hi all, I am trying to create a multiplication table. Basically the program will work like this.
The user will enter a number from 1-9. The output will show a multiplication table. If the user enter 0, then the program will stop and exit.

Example:
Enter selection number : 3
Multiplication table for 3
3 6 9
12 15 18
21 24 27
Enter selection number : 0
Exit Program.

I have done the coding but couldn't get the desired output. Will appreciate if anyone can rectify or point my mistakes and get the program to run as intended. Here is the cosing that I have done :

Code:
import java.util.Scanner; public class MultiTable { public static void main (String [] arg) { Scanner input = new Scanner(System.in); System.out.println("** Welcome to Multiplication Table **"); int n1; System.out.println("\nEnter selection number:"); n1 = input.nextInt(); { if(n1!=0) { System.out.println("Multiplication Table for " + n1); int store[] = new int[9]; for (int i=0; i<store.length; i++) { store[i] = i; } } else System.out.println("\nExit Program! \nThank You for using me!"); } } }
Thanks
Albert

Last edited by Albert : 07-09-2007 at 09:13 PM.
Reply With Quote
Sponsored Links