#include "stdafx.h"
#include <iostream>
usingnamespace std;
int main()
{
cout << "Enter a number"; //ask for a number
int a; //declare a as integer
cin >> a; //get number
int count=1; //declare count and give it a value of 1
dowhile (count <= a) //open loop - while count is less or equal to a
{
if (a%count == 0) //if the remainder of the number divided by count is 0 (it has found a factor)
{
if (count != 1) //if count doesn't equal 1 (not the first factor)
cout << " - " << count; //separate them and write count
else //if not (if the first factor)
cout << count; //just write count
}
count +=1; //add one to count
}
system("pause");
}