1234567891011121314151617181920212223242526272829303132333435363738394041 |
-
-
- public class TableUtilities {
- public static String getSmallMultiplicationTable() {
- String sumOf = "";
- for (int i=1; i<=5; i++){
- for (int b=1; b<=5; b++){
- sumOf += String.format( "%3d |", b*i);
- }
- sumOf += "\n";
- }
-
- return sumOf;
- }
-
-
- public static String getLargeMultiplicationTable() {
- String sumOf = "";
- for (int i=1; i<=10; i++){
- for (int b=1; b<=10; b++){
- sumOf += String.format( "%3d |", b*i);
- }
- sumOf += "\n";
- }
-
- return sumOf;
- }
-
- public static String getMultiplicationTable(int tableSize) {
- String sumOf = "";
- for (int i=1; i<=tableSize; i++){
- for (int b=1; b<=tableSize; b++){
- sumOf += String.format( "%3d |", b*i);
- }
- sumOf += "\n";
- }
-
- return sumOf;
- }
- }
|