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
Wt are the Buses in C Language
What is the use of f in c?
Define Array of pointers.
What type of function is main ()?
Explain how are portions of a program disabled in demo versions?
How can I read a binary data file properly?
How can variables be characterized?
What is table lookup in c?
Write a program which returns the first non repetitive character in the string?
Explain what is the difference between null and nul?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
What are different types of variables in c?
What are the modifiers available in c programming language?
Why do we use main function?
‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.