Factor of number are integers when divided with the number lives no reminder or 0 as reminder.
Example :
1,3 & 5 are three factors of number 15.
1,2,3,4,6 are factors of number 12
#include <stdio.h>
int main(void){
int i;
int num;
printf("Enter the number ");
scanf("%d",&num);
for ( i=1;i<num;i++){
if(num % i ==0){
printf("%d,",i);
}
}
return 0;
}
Output is here if you enter 12 as input
1,2,3,4,6,
There are some numbers for which only factors are 1 and itself ( same number ) , they are known as prime numbers.