In this challenge, we are going to use loops to do some simple math.
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.
A single integer, n.
Print 10 lines of output; each line i (where 1 = i = 10) contains the result of n x i in the form:
n x i = result.
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { int n = 2; /*from w ww . ja v a 2s .co m*/ int sum; for(int i = 1; i <= 10; i++){ sum = n * i; System.out.println(n + " x " + i + " = " + sum); } } }