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 actual argument?
How can a number be converted to a string?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
Write a C program to count the number of email on text
How are structure passing and returning implemented?
Did c have any year 2000 problems?
What is difference between Structure and Unions?
What is getch() function?
What are the types of operators in c?
How are variables declared in c?
what is the basis for selection of arrays or pointers as data structure in a program
Explain how do you print only part of a string?
What is const and volatile in c?
What is the use of #define preprocessor in c?
pierrot's divisor program using c or c++ code