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
write an algorithm to display a square matrix.
How are portions of a program disabled in demo versions?
What is enumerated data type in c?
Explain modulus operator. What are the restrictions of a modulus operator?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
What is difference between union and structure in c?
What is return in c programming?
What are integer variable, floating-point variable and character variable?
What are the advantage of c language?
What is the difference between variable declaration and variable definition in c?
What is operator precedence?
Explain about C function prototype?
Do you have any idea about the use of "auto" keyword?
What will be the outcome of the following conditional statement if the value of variable s is 10?