Factor of a number -
#include<stdio.h>
#include<conio.h>
void main()
{int n,x,i=1;
printf("\n enter a number \n");
scanf("%d",&n);
printf("factors=");
while (i<=n)
{x=n%i;
if(x==0)
{printf("%d,",i);
i++;
}
else
{i++;
}
}
getch();
return;
}
lets try this in your PC ......
#include<stdio.h>
#include<conio.h>
void main()
{int n,x,i=1;
printf("\n enter a number \n");
scanf("%d",&n);
printf("factors=");
while (i<=n)
{x=n%i;
if(x==0)
{printf("%d,",i);
i++;
}
else
{i++;
}
}
getch();
return;
}
lets try this in your PC ......
0 Comments