C++ Program to Find Denominator of Given Amount

C++ Program to Find Denominator of Given Amount

Write C++ Program to Find Denominator of Given Amount

// CPP Program to Find Denominator of Given Amount

#include <iostream>

using namespace std;

int main()
{
	int n;

	cout << "Enter the Amount :--> ";
	cin >> n;

	int div = 1;

	cout << "The Denominator of the Given Amount is :--> ";

	while(div < n)
	{
		if(n % div == 0)
		{
			cout << div << " ";
		}
		div++;
	}
	return 0;
}

Output:

Enter the Amount :--> 30
The Denominator of the Given Amount is :--> 1 2 3 5 6 10 15