# C++ Program to Display Factors of a Number

Factors are the numbers you multiply together to get another number.

For example, you get 2 and 3 as a factor pair of 6. If you also need negative factors you will need to duplicate the answer yourself and repeat all of the factors as negatives such as -2 and -3 as another factor pair of 6.

Factors are whole numbers that are multiplied together to produce another number. The original numbers are factors of the product number. If a x b = c then a and b are factors of c.

Say you wanted to find the factors of 16. You would find all pairs of numbers that when multiplied together resulted in 16. We know 2 and 8 are factors of 16 because 2 x 8 = 16. 4 is a factor of 16 because 4 x 4 = 16. Also 1 and 16 are factors of 16 because 1 x 16 = 16. The factors of 16 are 1, 2, 4, 8, 16.

#### The factors of 60 are:

1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60

1 × 60 = 60
2 × 30 = 60
3 × 20 = 60
4 × 15 = 60
5 × 12 = 60
6 × 10 = 60

### Example: C++ Program to Display Factors of a Number

#### Output

Enter a positive integer: 60
Factors of 60 are:
1 2 3 4 5 6 10 12 15 20 30 60