Factor of number are integers when divided with the number lives no reminder or 0 as reminder.

1,2,3,4,6 are factors of number 12

We will ask user to enter two input numbers and then find out the factors of both which are common to both

```
#include <stdio.h>
int main(void){
int i;
int num1,num2,highest_number,highest_common=0;
printf("Enter the first number ");
scanf("%d",&num1);
printf("Enter the second number ");
scanf("%d",&num2);
if(num1>num2){
highest_number=num1;
}else{highest_number=num2;}
for ( i=1;i<highest_number;i++){
if(num1 % i ==0 && num2 % i==0){
printf("Common factor = %d \n",i);
highest_common=i; // common factor is passed
}
}
printf("Highest common factor %d",highest_common);
return 0;
}
```

Output is here
```
Enter the first number 12
Enter the second number 18
Common factor = 1
Common factor = 2
Common factor = 3
Common factor = 6
Highest common factor 6
```

Common factor of two Numbers

This article is written by **plus2net.com** team.

* indicates required

Swapping two numbers sample code
Average of two numbers as entered by user
Highest of three numbers
Finding exam Grade of mark entered using if else condition
Calculation of user entered numbers
Percentage of Mark
Division of Mark
Digits in Number
Sum of Digits
Matrix Multiplication

Post your comments , suggestion , error , requirements etc here