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 is void main () in c?
Explain what does it mean when a pointer is used in an if statement?
How are 16- and 32-bit numbers stored?
What is the difference between single charater constant and string constant?
There seem to be a few missing operators ..
What is #error and use of it?
Write a program in c to replace any vowel in a string with z?
Are comments included during the compilation stage and placed in the EXE file as well?
What is bash c?
Why is c so important?
How is null defined in c?
What is operator promotion?
Hi can anyone tell what is a start up code?
Explain what is a stream?
What is external variable in c?