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 1f in c?
What is static volatile in c?
How can I direct output to the printer?
What are the types of type qualifiers in c?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
What is static memory allocation?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
What is unary operator?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
Explain what is the difference between a free-standing and a hosted environment?
write a program to generate address labels using structures?
What is a pointer variable in c language?
Is c still relevant?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
write a program to print largest number of each row of a 2D array