Learn about **C Program to Find Factors of a Number using a function** in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Contents

#### C Program to Find Factors of a Number using a function

Factors are whole numbers that are multiplied to create another number. The original numbers are product number factors. If an x b = c, then a and b are c’s factors.

The below program helps to find the factors of the number entered by the user using a Function.

**Source code:**

```
#include<stdio.h>
void findFactors(int n)
{
for(int i=1; i<=n/2; i++)
{
if(n%i==0)
printf("%d\t", i);
}
}
int main()
{
int number;
printf("Enter number: ");
scanf("%d",&number);
findFactors(number);
return 0;
}
```

**Output:**

Enter number: 12

1 2 3 4 6

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

**Similar Codes :**

C program to find the sum of factors of a number

Program to Find Factors of a Number in C Using the do-while loop