Write a program to generate prime factors of a given integer?
Answer Posted / shruthi chandran
voiid primeFactors(int n)
{
while (n%2 == 0)
{
printf("%d ", 2);
n = n/2;
}
for (int i = 3; i <= sqrt(n); i = i+2)
{
while (n%i == 0)
{
printf("%d ", i);
n = n/i;
}
}
if (n > 2)
printf ("%d ", n);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are variables c?
Why do some versions of toupper act strangely if given an upper-case letter?
What functions are used for dynamic memory allocation in c language?
How are portions of a program disabled in demo versions?
What is c definition?
Write a program to implement queue.
code for find determinent of amatrix
What is the difference between far and near ?
What kind of structure is a house?
Can a variable be both static and volatile in c?
Explain setjmp()?
program to convert a integer to string in c language'
Is there any data type in c with variable size?
Explain what is the difference between functions getch() and getche()?
Explain how do you override a defined macro?