Write a program in the C programming language to find the factors or divisible of the inputted number. Make this program by using ‘ for loop ‘. It also tells the total number of factors of the inputted number. Below is the solution of the program –

/* C program to find factors or divisible of a number */ #include<stdio.h> void main() { int n,i,rd,sum=0; printf("Enter any number \n"); scanf("%d",&n); printf(" Factors of %d are - \n",n); for(i=1;i<=n;i++) { rd=n%i; if(rd==0) { printf("\t %d",i); sum=sum+1; } } printf("\n \n %d is divible by %d numbers",n,sum); getch(); }

**Input** – 15

**Output** – Factors of 15 are – 1 3 5 15

15 is divisible by 4 numbers

I think its a very helpfull site for students…… thanks