text: Find all factors of a natural number | Set 1 | C implementation of Naive method to print all divisors ; function to print the divisors ; Driver program to test above function
code: #include <stdio.h> NEW_LINE void printDivisors ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) if ( n % i == 0 ) printf ( " % d ▁ " , i ) ; } int main ( ) { printf ( " The ▁ divisors ▁ of ▁ 100 ▁ are : ▁ STRNEWLINE " ) ; printDivisors ( 100 ) ; return 0 ; }