# Given a number return the prime factor multiplication using C/Java?

+1 vote
104 views
Given a number return the prime factor multiplication using C/Java?
posted Jun 13, 2017

``````#include<stdio.h>

int get_factor(int number)
{
int i = 1;
int sum = 0;

while(1)
{
sum+=i;
if(sum == number)
{
return i;break;
}
else if(sum > number)
{
return 0;break;
}
i++;
}
}

int main(void)
{
int number;
int ret;

printf("Enter the number : ");
scanf("%d",&number);
ret = get_factor(number);

if( ret != 0)
{
printf("%d is the factor of the %d",ret,number);
}
else
{
printf("the number dosent have factor");
}

getchar();
getchar();
return 0;
}
``````
Similar Questions

Given a sentence and a word, remove all occurrences of the word in the sentence.

For example, removing “is” from the sentence “This is a boy.” becomes “Th a boy.”

+1 vote

For Example:
the prime divisors of 450 are 4,5,3,3,2.

+1 vote

## OUTPUT

``````2 is a prime number in the array
5 is a prime number in the array
7 is a prime number in the array
11 is a prime number in the array
13 is a prime number in the array
19 is a prime number in the array
31 is a prime number in the array
37 is a prime number in the array
Min 2
Sum 123
``````