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 / mohammad nasim

include<stdio.h>
main()
{
int n;
printf("Enter a positive integer: ");
scanf("%d",&n);
printf("\nThe prime factors are:\n");
while((n/2)!= 0 || (n/3)!=0)
{
if(n%2==0)
{
printf("\t2");
n=n/2;
}
else
{
if(n%3==0)
{
printf("\t3");
n = n/3;
}
else
{
printf("\t%d",n);
break;
}

}
}

}

Is This Answer Correct ?    1 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is a structure member accessed?

1146


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

1141


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

1883


what are the different storage classes in c?

1191


How can I determine whether a machines byte order is big-endian or little-endian?

1069


Explain union.

1183


Explain how can type-insensitive macros be created?

1004


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

1222


Are there any problems with performing mathematical operations on different variable types?

1051


Why is c called c?

1035


Write a program with dynamically allocation of variable.

1148


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

1075


What is the role of && operator in a program code?

1084


how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....

1809


What is the difference between exit() and _exit() function?

1056