Program to print factors of a given number.
#include <stdio.h>
#include <conio.h>
void main()
{
int a, num;
clrscr();
printf ("Enter a number to find it's Factors: ");
scanf ("%d", &num);
printf ("Factors of the %d are: \n", num);
for (a = 1; a <= num; a++)
{
if (num%a == 0)
{
printf ("%d\t", a);
}
}
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a, num;
clrscr();
printf ("Enter a number to find it's Factors: ");
scanf ("%d", &num);
printf ("Factors of the %d are: \n", num);
for (a = 1; a <= num; a++)
{
if (num%a == 0)
{
printf ("%d\t", a);
}
}
getch();
}