Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class New {
- public static void main(String[] arguments) {
- Scanner scan = new Scanner(System.in);
- int one;
- int test1;
- int out1;
- ArrayList<Integer> fact1 = new ArrayList<>();
- System.out.println("Please Enter the first number you want to factor");
- one = scan.nextInt();
- // factor program
- factor1:
- for (test1 = 1; test1 < one; test1++) {
- if (one / test1 < test1) {
- break;
- }
- if (one % test1 == 0) {
- out1 = one / test1;
- fact1.add(out1);
- fact1.stream().forEach((num) -> {
- System.out.println(num);
- });
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement