/*According to Euclid's Geometric Position find Integer Factorization/Prime Factorization of Given Number */
#include <stdio.h>
int main(void)
{
int i,num,j;
printf("Enter a number whose Prime factors you want to find :");
scanf("%d",&num);
j = num ; //Assigning value of num to j
for ( i = 2 ; i <= j-1 ;i++)
{
while( num % i == 0)
{
printf("\n%d ",i );
num = num / i ;
continue;
}
}
printf("\n");
return 0;
}
#include <stdio.h>
int main(void)
{
int i,num,j;
printf("Enter a number whose Prime factors you want to find :");
scanf("%d",&num);
j = num ; //Assigning value of num to j
for ( i = 2 ; i <= j-1 ;i++)
{
while( num % i == 0)
{
printf("\n%d ",i );
num = num / i ;
continue;
}
}
printf("\n");
return 0;
}
No comments:
Post a Comment