I can't get the program to output just the prime factors (5, 7, 13, and 29) but only all prime numbers of 13195. This is a problem on Project Euler.

Code:

/* The prime factors of 13195 are 5, 7, 13 and 29.
/* A prime number is a numeral that is greater than 1 and cannot be divided evenly by any other number except 1 and itself. */
#include <stdio.h>
int main (void)
{
// long num = 600851475143;
// printf("%li\n", num);
int num = 13196;
int i, j;
int array[13195];
int new_array[13195];
for (i = 1; i < num; i++)
{
// element i of array being passed to second for loop
array[i] = i;
new_array[i] = i;
}
for(i = 1; i < num; i++)
{
// if array[i] is even, print the value of array[i]
if ((13195 % array[i] == 0)) // The prime factors of 13195 are 5, 7, 13, 29
{ // 13195 / 29 = whole number
new_array[i] = array[i]; // printf("%d, ", array[i]); copied into new_array[i]
if((13195 / new_array[i] == 0)) // printf("%d, ",array[i]); 13195 divided by new_array[i] equally is prime factor
{
printf("%d, ", new_array[i]);
}
// if 13195 is divided by new_array[i] equally it is a prime factor
}
}
printf("\n");
return 0;
}

Hey all I have a question with this line:

Code:

if((13195 / new_array[i] == 0))

Please what would be the best way to write this division arithmetic inside an if statement, if I replace the divide sign with a modulus operator I get a value to be computed and displayed. Thanks.