Header Ad

C Program to Print Factors of a given number

In this tutorial, we are going to make a C Program to Print Factors of a given number with step by step full complete explanation. 

C Program to Print Factors of a given number



C Program to Print Factors of a given number

#include<stdio.h>
#include<conio.h>
void main()
{
      int input, i;

printf("Enter any number:");
scanf("%d",&input);

for(i=1; i<=input; i++)

{
   if (input%i ==0)
     printf("%d, ",i);
}
getch();
}

Output

C Program to Print Factors of a given number

Post a Comment

0 Comments