okay so im having trouble getting the right outputs for this program i am writing for my class.
its supposed to be taking numbers from the user and analyzing them for their divisors(factors)
and also whether they are prime or perfect numbers(i haven't gotten to this point yet).
the problem with the outputs is that it won't put out all the divisors or will put out doubles.

Code:
#include <iostream>
using namespace std;
int main()

{
	int input,
		j, //number divding into the input number
		decider;
	double divisor; //an output number
		
	char ans;	
		
	do
	{	
		
		do
		{	cout << "Please enter a number between 1 and 1000" << endl;
			cin >> input;
		}
		while (!(input >= 1) || !(input <= 1000));

		cout << "Number: " << input << endl;
		if (input != 1)
			cout << "Divisors: ";
		else
			cout << "This number is neither prime nor perfect" << endl;
 
		for (j = 1; (j <= input) && (input % j == 0); j++)
		{	
			divisor = static_cast<float>(input)/j;
			if (divisor != j)
				cout << divisor<< " ";
								
			if (j != divisor)
				cout << j << " ";
		}
	
		cout << "\nWould you like to continue (Y/N)?\n";
		cout << "You must enter a Y or a N." << endl;
		cin >> ans;
	}
	while (((ans != 'n') && (ans != 'N')) || ((ans == 'Y') || (ans == 'y')));
		
	
return 0;

}