I'm trying to write code that will return equal dividers of a given number. I don't know where I'm wrong. Any help?
Code:
#include <iostream>
#include <stdlib.h>
using namespace std; // So the program can see cout and endl
int main()
{
int Numerator;
cout<<"Enter Numerator: ";
cin>>Numerator;
int Denominator = 1;
while (Denominator < Numerator) {
int divresult;
int check;
divresult = (Numerator / Denominator);
check = divresult * Denominator;
if(check = Numerator){
cout << divresult <<endl;
}
Denominator++;
}
return 0;
}
Desired Output:
9
3
1