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
How can I make it pause before closing the program output window?
Why should I use standard library functions instead of writing my own?
What extern c means?
What is difference between structure and union in c programming?
What are qualifiers in c?
Explain null pointer.
What are Macros? What are its advantages and disadvantages?
Do character constants represent numerical values?
Explain what’s a signal? Explain what do I use signals for?
What is an example of structure?
What is c value paradox explain?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
What are extern variables in c?
What are identifiers and keywords in c?
What is difference between class and structure?