Using a for loop, I have wrote a program that displays a “6 times table” multiplication table:
public class TimesTable3_4a
public static void main(String args)
int table = 6;
for ( int row=1; row<=12; row++ )
System.out.println( row + " * " + table + " = " +
( table * row ) );
How could I adapt the above program so that instead of a “6 times” table, the user chooses which table is displayed?
Thanks in advance.
the user can gice the program info in the following way:
java TimesTable3_4a 6
This would give a 6 to the application.
Parameters passed to applications in such a way end up in the String args variable.
(order in wich they appear is the same as wich they were entered on command line.
This should send you in the right way...
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center