Java Day 5: Loops



Given an integer,n , print its first 10 multiples. Each multiple n x i (where 1<= i <= 10) should be printed on a new line in the form: n x i = result.



  1. import java.io.*;
  2. import java.math.*;
  3. import java.security.*;
  4. import java.text.*;
  5. import java.util.*;
  6. import java.util.concurrent.*;
  7. import java.util.regex.*;
  8. public class Solution {
  9. public static void main(String[] args) {
  10. Scanner in = new Scanner(System.in);
  11. int N = in.nextInt();
  12. in.close();
  13. for (int i = 1; i < 11; i++) {
  14. System.out.println(N + " x " + i + " = " + N * i);
  15. }
  16. }
  17. }