WAP in C to find all the factors of a given number.

 /*This program is to find all factors of a inputed nums'*/

#include <stdio.h>

#include <conio.h>


int main()

{

int num, i;


printf("Enter a number: ");

scanf("%d", &num);

printf("Factors of %d are:", num);


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

{

if (!(num%i))

{

printf(" %d ", i);

}

}

getch();

return 0;

}


Comments