D. In tất cả ước số của một số


Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 256M

Problem type

Đề bài: Viết hàm in_uoc(n) để in ra các ước số của n theo thứ tự tăng dần.

Input: Một số nguyên dương n (1 ≤ n ≤ 1000)

Output: Các ước số cách nhau bởi dấu cách

Input:
12
Output:
1 2 3 4 6 12

Input:
15
Output:
1 3 5 15

def in_uoc(n):
    for i in range(1, ___ + 1):
        if ___ % i == 0:
            print(i, end=' ')

n = int(input()) in_uoc(n)


Comments

There are no comments at the moment.