Write a program to generate prime factors of a given integer?
Answer Posted / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int num,i,f=0,k=0,d,m;
printf("\n Enter the number ");
scanf("%d",&num);
m=num;
while(k<=m)
{
k=k+1;
f=0;
d=num%k;
if(d==0)
{
i=2;
while(i<=k-1)
{
if(k%i==0)
{
break;
}
i++;
}
if(i==k)
{
printf("\nPrime Factor %d ",k);
}
}
}
getch();
}
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is assert and when would I use it?
When should the volatile modifier be used?
What is exit() function?
What Is The Difference Between Null And Void Pointer?
what is uses of .net
Explain how do you print only part of a string?
how to make a scientific calculater ?
What is operator promotion?
What are structure members?
Why array is used in c?
What does the error 'Null Pointer Assignment' mean and what causes this error?
Can we declare variable anywhere in c?
will u please send me the placement papers to my mail???????????????????
praagnovation
Write a program of advanced Fibonacci series.