Write a program to generate prime factors of a given integer?
Answer Posted / rajesh kumar s
int main()
{
int n,num,i;
printf("enter the num");
scanf("%d",&num);
n=num;
printf("\n");
for(i=2;i<=n/2;i++)
{
if(n%i==0)
{
prime(i);
}
}
}
void prime(int x)
{
int i,f=0;
for(i=2;i<=x/2;i++)
{
if(x%i==0)
{
f=1;
break;
}
}
if(f==0)
printf(" %d",x);
}
Is This Answer Correct ? | 49 Yes | 40 No |
Post New Answer View All Answers
What is a stream water?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
Which is the best website to learn c programming?
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What is difference between main and void main?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
write a program in c language to print your bio-data on the screen by using functions.
Describe the order of precedence with regards to operators in C.
What is meant by recursion?
Why is this loop always executing once?
What is a memory leak? How to avoid it?
What is output redirection?
Do character constants represent numerical values?
Give basis knowledge of web designing ...
Is fortran faster than c?