Answers for "multiplication table in java using nested for loop"

1

java multiplication table nested loop

public class Main {
  public static void main(String[] args) {
    for (int y = 1; y < 12; ++y) {
      for (int x = 1; x < 12; ++x) {
        System.out.printf("%4d", y*x);
      }
      System.out.println();
    }
  }
}
Posted by: Guest on January-25-2021
-3

Multiplication table for number Java

public static String multiTable(int num) {
        StringBuilder sb = new StringBuilder();

        for (int i = 1; i <= 10; i++) {
            int result = i * num;
            sb.append(i + " * " + num + " = " + result + "n");
        }
        return sb.toString().trim();
    }
Posted by: Guest on November-25-2020

Code answers related to "multiplication table in java using nested for loop"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language