Need help with my JAVA homework ASAP thank you so much Write

Need help with my JAVA homework ASAP, thank you so much.

Write a program that uses a Scanner to read a number (say N) and prints the sequence of multiples of N up to exactly N times N. You should test your program twice using two different numbers. It works as follows:

Solution

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class FindTheMultipleOfNumber {

public static void main(String[] args) {
int a;
Scanner in = new Scanner(System.in);
List<Integer> ints = new ArrayList<>();
System.out.print(\"please type a number: \");
a = in.nextInt();
for (int i = a; i <= a * a; i++) {
if (i % a == 0) {
ints.add(i);
}
}
ints.stream().forEach((i) -> {
System.out.print(\"\\t\" + i);
});
System.out.println();
}

}

Output:...

please type a number: 12
   12   24   36   48   60   72   84   96   108   120   132   144

-----------------------------------------------------------------------------------------------

please type a number: 8
   8   16   24   32   40   48   56   64

if output is not according to your requirement please tell me..

Need help with my JAVA homework ASAP, thank you so much. Write a program that uses a Scanner to read a number (say N) and prints the sequence of multiples of N

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site