code:
#include<stdio.h>
void func();
int main()
{
func();
}
void func()
{
int n,i;
scanf("%d",&n);
printf("\n");
for(i=1; i<=n; i++) //you have to think about the logic here
{
if(n%i==0)
{
printf("%d\n",i);
}
}
return 0;
}
Formula: https://www.mathsisfun.com/definitions/divisor.html
This formula link will help you to think about the logic.
Got this problem from 101cproblems.com