Print All Divisors of a Number
Advanced Maths DSA practice problem on Onlearn.
Difficulty: easy.
Topics: All Divisors of a Number, Divisors, Mathematical Algorithms, Loops, Conditional Statements, Time Complexity, Space Complexity, Big O Notation, Basic Arithmetic, Sorting, time complexity analysis, search algorithms, number theory, Algorithm Optimization, Searching.
Problem Statement Given a positive integer N, your task is to find all its positive divisors and print them in ascending order. Input Specification A single line containing an integer N (1 <= N <= 10^6). Output Specification Print all positive divisors of N in ascending order, separated by a single space. Constraints 1 <= N <= 10^6 Sample Test Cases Sample Input 1: 12 Sample Output 1: 1 2 3 4 6 12 Sample Input 2: 7 Sample Output 2: 1 7 Difficulty: Easy