class Main {
        public static void main(String[] args) {
          // negative number
          int number = -60;
          System.out.print("Factors of " + number + " are: ");
          // run loop from -60 to 60
          for(int i = number; i <= Math.abs(number); ++i) {
            // skips the iteration for i = 0
            if(i == 0) {
              continue;
            }
            else {
              if (number % i == 0) {
                System.out.print(i + " ");
              }
            }
          }
        }
      }
      
      Java language logo

      Factor of NUum

      0

      0

      avatar
      natalie19970

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.