Tìm tất cả các ước của một số python

Viết chương trình Python để tìm tất cả các ước của một số nguyên hoặc số bằng vòng lặp for. Trong ví dụ Python này, vòng lặp for lặp từ 1 đến một số đã cho và kiểm tra xem mỗi số có chia hết cho số không. Nếu Đúng, in số đó dưới dạng ước số

Show
    num = int(input("Please enter any integer to find divisors = "))
    
    print("The Divisors of the Number = ")
    
    for i in range(1, num + 1):
        if num % i == 0:
            print(i)
    Tìm tất cả các ước của một số python

    Chương trình Python tìm tất cả các ước của một số nguyên bằng vòng lặp while

    num = int(input("Please enter any integer to find divisors = "))
    
    
    i = 1
    
    while(i <= num):
        if num % i == 0:
            print(i)
        i = i + 1
    Please enter any integer to find divisors = 100
    
    1
    2
    4
    5
    10
    20
    25
    50
    100

    Trong ví dụ Python này, chúng tôi đã tạo một hàm findDivisors sẽ tìm và trả về tất cả các ước của một số đã cho

    def findDivisors(num):
        for i in range(1, num + 1):
            if num % i == 0:
                print(i)
    # End of Function
    
    num = int(input("Please enter any integer to find divisors = "))
    
    findDivisors(num)
    Please enter any integer to find divisors = 500
    
    1
    2
    4
    5
    10
    20
    25
    50
    100
    125
    250
    500

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    6
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    7_______6_______8

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    8
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4// A O(sqrt(n)) program that prints all divisors0// A O(sqrt(n)) program that prints all divisors1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______660_______3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    8
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4// A O(sqrt(n)) program that prints all divisors0// A O(sqrt(n)) program that prints all divisors1

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// in sorted order1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// in sorted order3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______665_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9// in sorted order5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______670_______1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3 #include 6

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    8
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4// A O(sqrt(n)) program that prints all divisors0using1

    // in sorted order5

     

    using3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3 using5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______8
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4namespace0namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______5 namespace6

    // in sorted order5

    Java




    namespace8

    // in sorted order

     

    std;0 std;1

     

    std;2 std;3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______685_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______685_______7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    4

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    07_______5_______08
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    09

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4_______5_______3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    14
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15_______5_______16

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    19_______5_______20
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    21

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7_______5_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    28// A O(sqrt(n)) program that prints all divisors0// A O(sqrt(n)) program that prints all divisors1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    28// A O(sqrt(n)) program that prints all divisors0// A O(sqrt(n)) program that prints all divisors1

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27// in sorted order1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    41

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// in sorted order5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______665_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9// in sorted order5

     

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9#include 1

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4_______5_______3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    54
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    56
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    20
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    58

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______28// A O(sqrt(n)) program that prints all divisors0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    62

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______66

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______68 std;7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    71

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    75
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    76namespace1

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    80namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    // in sorted order5

    Python3




    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    85

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    86

    std;0

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    88

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    89

     

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    90
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    91

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______93
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    95

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00_______6_______01
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    02
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    05_______5_______3_______6_______07
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    08
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    10

     

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    13_______6_______14
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    20
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    19

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______6_______21

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______0
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    13_______6_______25
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    29

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    31
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    32
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______660_______3_______6_______38

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    40

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    31
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    32
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    93
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    49
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    13
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    25
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    53

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______55

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00_______6_______01
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    93
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    61
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    62
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    64

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    31
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    32
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

     

     

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    71

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    31_______6_______4_______5_______76
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______80
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

     

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    79

    C#




    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    80

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    81

    using

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    83

     

    std;2

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    85

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______685_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______685_______7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    4

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    97

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    99

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3_______5_______02_______5_______08
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3_______5_______05

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    08

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    13

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7_______5_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    23
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    23
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27_______5_______34

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    36

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    27_______5_______38

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// in sorted order5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______665_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9// in sorted order5

     

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    46

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    48

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    53

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______55
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______61

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______68 std;7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    66

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    70namespace0namespace1

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9namespace3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    // in sorted order5

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    78

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    79

    PHP




    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    80

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    81

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    82

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    83

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    84

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    85

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    86
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______88
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______99

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______96
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______99 // A O(sqrt(n)) program that prints all divisors00

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4// A O(sqrt(n)) program that prints all divisors04 // A O(sqrt(n)) program that prints all divisors05

    // A O(sqrt(n)) program that prints all divisors06// A O(sqrt(n)) program that prints all divisors04 // A O(sqrt(n)) program that prints all divisors08

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    88namespace1// A O(sqrt(n)) program that prints all divisors04// A O(sqrt(n)) program that prints all divisors12

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4_______5_______88
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    14// A O(sqrt(n)) program that prints all divisors04 // A O(sqrt(n)) program that prints all divisors21

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______0 // A O(sqrt(n)) program that prints all divisors28_______5_______88
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    25// A O(sqrt(n)) program that prints all divisors04 // A O(sqrt(n)) program that prints all divisors32// A O(sqrt(n)) program that prints all divisors04
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors36 // A O(sqrt(n)) program that prints all divisors04 // A O(sqrt(n)) program that prints all divisors38
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______660_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors36 // A O(sqrt(n)) program that prints all divisors04 // A O(sqrt(n)) program that prints all divisors38
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors52

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors54

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    96// A O(sqrt(n)) program that prints all divisors57
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    99// A O(sqrt(n)) program that prints all divisors59
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    88
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    25// A O(sqrt(n)) program that prints all divisors04
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______665_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9// in sorted order5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______46

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______48

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4// A O(sqrt(n)) program that prints all divisors04
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94// A O(sqrt(n)) program that prints all divisors79
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    96// A O(sqrt(n)) program that prints all divisors82

    // A O(sqrt(n)) program that prints all divisors06// A O(sqrt(n)) program that prints all divisors04 // A O(sqrt(n)) program that prints all divisors85// A O(sqrt(n)) program that prints all divisors04// A O(sqrt(n)) program that prints all divisors87

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9// A O(sqrt(n)) program that prints all divisors36
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    96// A O(sqrt(n)) program that prints all divisors57// A O(sqrt(n)) program that prints all divisors04// A O(sqrt(n)) program that prints all divisors93
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34_______5_______97

    // in sorted order5

     

    // A O(sqrt(n)) program that prints all divisors97

    // A O(sqrt(n)) program that prints all divisors36 namespace0

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

    namespace3

     

    // in sorted order02

    // in sorted order03

    Javascript




    // in sorted order04

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    81

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    82

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    83

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    84

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    85

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    86 // in sorted order11

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______99

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______18

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______20

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3 // in sorted order23

    // A O(sqrt(n)) program that prints all divisors06// in sorted order25

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______0 // in sorted order37

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// in sorted order39
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______660_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// in sorted order39
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors52

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// A O(sqrt(n)) program that prints all divisors54

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    7// in sorted order55

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______665_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9// in sorted order5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______46

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______48

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3 // in sorted order68

    // A O(sqrt(n)) program that prints all divisors06____665_______70

    // A O(sqrt(n)) program that prints all divisors06// in sorted order72

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    // in sorted order5

     

    // A O(sqrt(n)) program that prints all divisors97

    // in sorted order79_______677_______0namespace1

    namespace3

     

    // in sorted order83

     

    // in sorted order84

    Đầu ra

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 

    Thời gian phức tạp. O(sqrt(n))
    Không gian phụ trợ. O(sqrt(n))

    Phương pháp 2

    Tiếp cận. Trong cách tiếp cận bên dưới bằng cách sử dụng vòng lặp for, trước tiên chúng ta chỉ in các số có phần dư là 0 và một khi chúng ta phá vỡ vòng lặp, chúng ta chỉ in thương của các số có phần còn lại là 0

    Hãy hiểu thông qua một ví dụ.  

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop

    C++




    // A O(sqrt(n)) program that prints all divisors

    // in sorted order

    // in sorted order87

    // in sorted order88

    using namespace std;

     

    // in sorted order92

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    4

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______3 #include 00

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3 #include 03

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______670_______08
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______0 #include 15

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9#include 17

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3 #include 22

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______670_______27
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    // in sorted order5

     

    // A O(sqrt(n)) program that prints all divisors97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3 using5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______670_______38namespace0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    97

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______3

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______5 namespace6

    // in sorted order5

     

    #include 47

    C




    // A O(sqrt(n)) program that prints all divisors

    // in sorted order

    #include 50

    // in sorted order88

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    4

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5_______5_______3 #include 00

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3 #include 62

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______8
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4// A O(sqrt(n)) program that prints all divisors0_______660_______1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    #include 73_______5_______0#include 75

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    #include 78#include 17

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3 #include 22

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______8
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4// A O(sqrt(n)) program that prints all divisors0_______670_______92

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    // in sorted order5

     

    using3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3 using5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______8
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4namespace0namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______5 namespace6

    // in sorted order5

    Java




    using11

    using12

    std;0 using14

     

    std;2 using16

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6

    // in sorted order92

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    68 std;7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    4

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5_______5_______3 #include 00

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3_______673_______30
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15using32

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    19_______5_______20_______6_______35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______673_______41____6_______34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______0using48
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    #include 78#include 17

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3_______673_______59
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15_______5_______58

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    19_______5_______20_______6_______35

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______673_______70
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    // in sorted order5

     

    // A O(sqrt(n)) program that prints all divisors97

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    68 std;7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1 using80

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______75
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    76namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______2
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    80namespace1

    // in sorted order5

    // in sorted order5

     

    using93

    Python3




    using94

    using95

    using96

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    88std;0 using99

     

    namespace00

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    90 namespace02

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______00_______5_______94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______08 namespace09using99 namespace11

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    13_______6_______14
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    20
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    19

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______6_______31
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    32_______5_______94
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

     

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    08
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    01
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    02
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3namespace39_______5_______20
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    05
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    62
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    15
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    19

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    13_______6_______14
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    00
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    20
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    19

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______6_______31
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    13
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    25
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    25 namespace59
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    94
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

     

    namespace63

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    31_______6_______4_______5_______76
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______80
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    35

     

    namespace71

    C#




    namespace72

    namespace73

    using

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    83

    using namespace77

    using namespace79

     

    std;2 using16

     

    // in sorted order92

    std;7

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    4

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3_______6_______4
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3 namespace93

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______5_______23
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4_______5_______3 std;09
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    3std;11

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______5

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______685_______18
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    std;23

    std;24

    std;25

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    68 std;7
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    1 std;29std;30 std;31

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______5_______70namespace0namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______3

    // in sorted order5

    // in sorted order5

     

    std;42

    Javascript




    // in sorted order04

     

    // A O(sqrt(n)) program that prints all divisors

    // in sorted order

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    86 // in sorted order11

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4std;53 std;54

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______665_______39
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______6_______3
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    4std;53 std;68

    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    9
    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    0 // in sorted order30

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    2_______665_______79
    n = 10 
    from 1 to 10
    keep checking n % 1 == 0 print 1
                  n % 2 == 0 print 2
                  3, 4, 5, 6, 7, 8, 9 will not give remainder 0 
                  exit loop;
                  
    The 1 and 2 which gives remainder as 0 it also mean that n is perfectly divisible by 1 and 2 so in second for loop keep printing the quotient on dividing by 1 and 2 which left remainder 0
    from 10 to 1 
    keep checking n % 1 == 0 print n/1 
                  n % 2 == 0 print n/2   
                  exit loop
    34 std;75

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______5

    // in sorted order5

     

    std;79

     

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______665_______79namespace0namespace1

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6_______677_______3

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 
    6

    std;87

     

    // in sorted order84

    Đầu ra

    The divisors of 100 are: 
    1 2 4 5 10 20 25 50 100 

    Độ phức tạp về thời gian. O(sqrt(n))

    Không gian phụ trợ. Ô(1)
    Cảm ơn Mysterious Mind đã gợi ý giải pháp trên

    Điều kiện if giữa hai vòng lặp được sử dụng khi các thừa số góc trong điều kiện của vòng lặp có chênh lệch bằng 1 (ví dụ: thừa số 30 (5,6) ở đây, 5 sẽ được in hai lần; để giải quyết vấn đề đó, bước này là bắt buộc

    Bài viết này được đóng góp bởi Ashutosh Kumar. Vui lòng viết nhận xét nếu bạn thấy bất cứ điều gì không chính xác hoặc nếu bạn muốn chia sẻ thêm thông tin về chủ đề đã thảo luận ở trên