C Program to Print Divisors of Number n

//WAP TO PRINT ALL DIVISOR OF A NUMBER

#include <stdio.h>

int main()
{
	int n , i;
	printf("Enter the number :--> ");
	scanf("%d", &n);

    printf("Divisor of %d --> ", n);
	for(i = 2; i < n; i++)
	{
		if( n % i == 0)     //here i is the divisor
		{
			printf("%d ", i);
		}
    }
	return 0;
}

<< Previous | Next >>