Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Solution {
  4. public static void main(String[] args) {
  5. try(Scanner in = new Scanner(System.in)) {
  6. int N = in.nextInt();
  7. int sum = 1;
  8. for(int i = 2; i * i <= N; i++) {
  9. if((N % i) == 0) {
  10. sum += i;
  11. int otherDiv = N / i;
  12. if(otherDiv != i) {
  13. sum += otherDiv;
  14. }
  15. System.out.println("div1: " + i);
  16. System.out.println("div2: " + otherDiv);
  17. }
  18. }
  19. System.out.println("Summation: " + sum);
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement