C++ Program to Find Divisors of a Number

The following is the C++ program to discover every one of the divisors of a number.

A divisor is a number that partitions another number totally. For instance D is the divisor of N if N%D=0.

using namespace std;
int main()
	long int n,i;
	cout<<"Enter the number: ";
	cout<<endl<<"Divisors of "<<n<<" are";
			cout<<" "<<i;
	return 0;


Enter the number: 6

Divisors of 6 are 1 2 3 6

Leave a Comment

error: Alert: Content is protected!!