C Program to Generate Prime Factor

Definition of Prime Factor from Wikipedia: In number theory, the prime factors of a positive integer are the prime numbers that divide that integer exactly. The process of finding these numbers is called integer factorization, or prime factorization.

Example: Prime factors of 288 are:
288 = 2 x 2 x 2 x 2 x 2 x 3 x 3

Here is a you tube video for you that will help you to understand prime factorization.

Now we are moving towards a C program that will find the prime factors of a number.

C Program to Find Prime Factors:

#include <stdio.h>

int main()
    int number,div;    
    printf("Enter a number to know its prime factor: ");    
    printf("\nThe prime factors of %d are: \n\n",number);
    div = 2;
            div = div + 1;
        else {
            number = number / div;
            printf("%d ",div);
    return 0;