# Algorithm statement in my Java codes

• 06-24-2008, 02:11 PM
javanewbie
Algorithm statement in my Java codes
Good day everyone.

I'm still confused on how the process/algorithm will work here:

Code:

``` // i've added + 1 to have an initial value of 1 (?) // <confused> int aiNumbers[][] = new int[Integer.parseInt(args[0])+ 1] [Integer.parseInt(args[1]) + 1]; // <confused> if(args[0].equals("0") || args[1].equals("0")) {       System.out.println("0"); } else {             // <confused> sorry, im a newbie.       for(int iCtr=1;iCtr < aiNumbers.length; iCtr++) {                                       for(int iCtr2=1;iCtr2 < aiNumbers[iCtr].length; iCtr2++) {                                             aiNumbers[iCtr][iCtr2] = iCtr * iCtr2;                     System.out.print(aiNumbers[iCtr][iCtr2] + " ");               }               System.out.println("");         } }```
Sorry Eranga. I still don't know how the process start and I don't even know how should I describe the process.

Would someone help me on making good algorithm statements here?

By the way, this code allows two arguments to be inputted by user to display like a 'multiplication table' depends on the 2 inputs.
Here I used multidimensional arrays.

I've tried simplier codes without arrays. But we are required to do it in a array.

:confused:
• 06-24-2008, 03:26 PM
sukatoa
Quote:

By the way, this code allows two arguments to be inputted by user to display like a 'multiplication table'
describe what's that two arguments to be added at runtime...
What's the model of your multiplication table?

You must idendify what should be used for the row and the column.
• 06-24-2008, 03:52 PM
javanewbie
Ok here's the program works.

First, the user will be ask for 2 inputs using commandline arguments.

Then the program will display something like this:
1st no: 2 (user input)
2nd no: 5 (user input)

Display:
1 2 3 4 5
2 4 6 8 10

I have no problems regards to the validation on how many inputs are required in the program.

With those codes, how can you describe a statement with a program like this?

1st no: 8 (user input)
2nd no: 2 (user input)

Display:
1 2
2 4
3 6
4 8
5 10
6 12
7 14
8 16