A factor is a whole number which divides exactly into a whole number, leaving no remainder. For example, 13 is a factor of 52 because 13 divides exactly into 52 (52 ÷ 13 = 4 leaving no remainder). The complete list of factors of 52 is: 1, 2, 4, 13, 26, and 52 (all these divide exactly into 52).
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
printf("Enter a number: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
printf("%d\t",i);
}
getch();
No comments:
Post a Comment