# Thread: Algorithm statement in my Java codes

1. Member
Join Date
Jun 2008
Location
Australia
Posts
43
Rep Power
0

## Algorithm statement in my Java codes

Good day everyone.

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

Java 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:

2. 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.

3. Member
Join Date
Jun 2008
Location
Australia
Posts
43
Rep Power
0
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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•