#include
long long int x; // This takes values from -9,223,372,036,854,775,807 to +9,223,372,036,854,775,807
int factors[10]; // This assumes there are no more than 10 prime factors
int i, j;
int z = 0;
int main ()
{
printf ("Please enter a positive integer: ");
scanf ("%lli", &x); // Take the entered quantity and assign it to x
do
{
for (i = 2; x % i != 0; i++) // This finds a prime factor and calls it i
;
factors[z] = i; // This stores the prime factor in memory
z++;
x = x / i; // Cancel this prime factor from x
} while (x != 1); // Keep going until the provided number becomes 1
printf ("\nThe prime factors are as follows:\n\n");
for (j = 0; j < z; j++)
printf ("%d\n\n", factors[j]); // Display all the memorized prime factors from smallest to largest
return 0;
}