Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ConsoleProgramSample {
- public static void main(String[] args) {
- for (int n = 1; n < 10000; ++n) {
- System.out.print("n = " + n + ", output = ");
- final var total = total(n);
- System.out.println(total);
- }
- }
- private static int total(int a) {
- int sum = 0;
- for (int rem = 1; rem <= a; rem++) {
- if (a % rem == 0)
- sum++;
- }
- return sum;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement