Thursday, 22 September 2011

Program to find all factors of a +ve number in C language


All factors of a given positive number in c


#include<stdio.h>
#include<conio.h>
void main()
{
int n,i;
clrscr();
printf("Enter the number: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
printf("\n%d",i);
}
getch();
}

No comments:

Post a Comment