JeffGrigg icon

Untitled

JeffGrigg | PRO | 11/04/22 12:19:00 AM UTC | 0 ⭐ | 14366 👁️ | Never ⏰ | []
Java 5 |

0 B

|

None

|

0 👍

/

0 👎

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;
    }
 
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎