Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are variables c?

998


Why do some versions of toupper act strangely if given an upper-case letter?

1037


What functions are used for dynamic memory allocation in c language?

1077


How are portions of a program disabled in demo versions?

1231


What is c definition?

1195


Write a program to implement queue.

1066


code for find determinent of amatrix

1917


What is the difference between far and near ?

1156


What kind of structure is a house?

994


Can a variable be both static and volatile in c?

974


Explain setjmp()?

1008


program to convert a integer to string in c language'

2398


Is there any data type in c with variable size?

1033


Explain what is the difference between functions getch() and getche()?

989


Explain how do you override a defined macro?

1019