So I am writing a code where the program will keep asking for a number and calculate its prime factorization unless the user enters 1 or less. What am I doing wrong?
Code:#include<stdio.h> int main() { int x, i; while (x > 1) { printf("Enter an integer: "); scanf("%d", &x); printf("The prime factorization of %d is ", x); while (x % 2 == 0) { printf("2 "); x = x / 2; } for (i = 3; i < 1009; i = i + 2) { while (x % i == 0) { printf("%d ", i); x = x / i; } } } return 0; }