123456789101112131415161718192021222324 |
-
-
- public class TableUtilities {
- public static String getSmallMultiplicationTable() {
- return getMultiplicationTable(5);
- }
-
- public static String getLargeMultiplicationTable() {
- return getMultiplicationTable(10);
- }
-
- public static String getMultiplicationTable(int tableSize) {
- StringBuilder table = new StringBuilder();
- for(int i=1;i<=tableSize;i++){
- for(int t=1;t<=tableSize;t++){
- table.append(String.format("%3d |",i*t));
- }table.append("\n");}
-
-
- return ""+table;
- //;
- }
- }
|