In this program we take an input n for which we will find the factors. Factors of a number n are those numbers which can completely divide the given number n. So, In this program we will input the number n and will iterate from 1 to the number n and will output those numbers which will divide the input number n completely. C++ Program to find the factors of a number is given below.

```
#include<iostream>
using namespace std;
int main()
{
int number, factor = 1;
cout << "Enter the number to generate its factors : " << "\n";
cin >> number;
cout << "The factors of " << number << " are : " << "\n";
while (factor <= number)
{
if (!(number % factor)) {
cout << factor << " ";
}
factor++;
}
cout<< "\n";
return 0;
}
```

OUTPUT: