Prime Factor in c
Prime factor Basic funda
In number theory, the prime factors of a positive integer are the prime numbers that divide that integer exactly. The prime factorization of a positive integer is a list of the integer's prime factors, together with their multiplicities; the process of determining these factors is called integer factorization. The fundamental theorem of arithmetic says that every positive integer has a single unique prime factorization.
To shorten prime factorization, factors are often expressed in powers (multiplicities). For example,
in which the factors 2, 3 and 5 have multiplicities of 3, 2 and 1, respectively.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j,k;
clrscr();
printf("Give upper range:");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=2;j<=i;j++)
{
if(n%i==0)
{
if(i%j==0)
break;
}
}
if(i==j)
printf("The prime factor is:%d\n",j);
}
getch();
}
Comments
Post a Comment